MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# What happens when you apply relational operations on 2 vectors of equal and unequal length in R?

# What happens when you apply relational operations on 2 vectors of equal and unequal length in R?

This recipe explains what happens when you apply relational operations on 2 vectors of equal and unequal length in R

Vector is a type of object or data structure in R-language. They are designed to store multiple values of same data-type. For example: if you want to store different 50 food items for each cuisine, you don't need to create 50 variables for each cuisine but just a vector of length 50 of datatype character.

Note: It can not have a combination of any two datatype. It has to be homogeneous in nature.

Relational operations between two vector is where every element of vector is compared to the corresponding element in another vector. We use different Relational operators to carry out this task. The output of the operation is a boolean vector.

This recipe demonstrates relational operation with two examples:

- comparing 2 vectors with equal length
- comparing 2 vectors with unequal length

We use combine function "c()" to create a vector

```
a = c(2,5,8,9,10)
b = c(5,6,10,20,2)
``````
```## Step 2: Element-wise comparison

We use relational operator greater than (">") to illustrate this operation. This gives us a boolean vector specifying whether the condition was met or not

```
print(a>b)
```

[1] FALSE FALSE FALSE FALSE TRUE

## 2. comparing 2 vectors with unequal length

## Step 1: Creating 2 vectors

We use combine function "c()" to create a vector

```
a = c(2,5,8,9,10)
b = c(5,6,10)
```

## Step 2: Element-wise comparison

We use relational operator greater than (">") to illustrate this operation. This gives us a boolean vector specifying whether the condition was met or not

```
print(a>b)
```

Warning message in a > b:
"longer object length is not a multiple of shorter object length"
[1] FALSE FALSE FALSE TRUE TRUE

Note: it gives a warning message ""longer object length is not a multiple of shorter object length" as well as it returns TRUE for every extra element that is present in the longer vector

Build your own image similarity application using Python to search and find images of products that are similar to any given product. You will implement the K-Nearest Neighbor algorithm to find products with maximum similarity.

In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.

In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

Use the Adult Income dataset to predict whether income exceeds 50K yr based on
census data.

In this deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.

In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.