MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to find if a vector has nan value in it?

# How to find if a vector has nan value in it?

This recipe helps you find if a vector has nan value in it

An NAN value in R represents “NOT A NUMBER”, It is basically any numeric calculation with an undefined result, such as ‘0/0’. This exists only in vectors with numeric datatype. Even one NAN value in a vector causes difficulty to carry out calculations. Hence, we need to remove or replace it before carrying out any calculation.

Before we actually remove or replace them, we need to check whether there is an NAN number in a vector and for this we use is.nan() function.

This recipe demonstrates how to find if a vector has NAN values.

We create two vectors, one with NAN values and the other without it.

```
a = c(2,5,8,20,NaN, 35,NaN)
b = c(2,5,8,20,75,35,100)
```

we use any() and is.nan() function to check for NaN values. It returns a logical value TRUE even if 1 Nan value is present.

```
#checking for NaN values in "a" vector
any(is.nan(a))
```

TRUE

```
#checking for NaN values in "b" vector
any(is.nan(b))
```

FALSE

Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

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.

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.

Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.

In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

There are different time series forecasting methods to forecast stock price, demand etc. In this machine learning project, you will learn to determine which forecasting method to be used when and how to apply with time series forecasting example.

In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.