Removing empty cells

From the data analysis, we detect an empty cell at the third row and second column. It is necessary to eliminate this anomaly before you can analyze the data frame. To do this, we can enter a NA value in the empty cell.

To set all of the empty cells to a NA value we can act as follows:

SampleData[SampleData==""]<-NA

To confirm the operation, we'll see the summary using summary function again:

summary(SampleData)

The results are shown in the following figure:

Now, in the age column there is an NA value. The same result could be done when reading the dataset, when we use the read.csv function. Let's see how:

SampleData=read.csv ...

Get Regression Analysis with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.