Skip to Content
Regression Analysis with R
book

Regression Analysis with R

by Giuseppe Ciaburro, Pierre Paquay, Manoj Kumar, Shaikh Salamatullah
January 2018
Beginner to intermediate
422 pages
9h 47m
English
Packt Publishing
Content preview from Regression Analysis with R

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Quantitative Finance with R

Learning Quantitative Finance with R

PRASHANT VATS, Dr. Param Jeet
R: Data Analysis and Visualization

R: Data Analysis and Visualization

Tony Fischetti, Brett Lantz, Jaynal Abedin, Hrishi V. Mittal, Bater Makhabel, Edina Berlinger, Ferenc Illés, Milán Badics, Ádám Banai, Gergely Daróczi, Barbara Dömötör, Gergely Gabler, Dániel Havran, Péter Juhász, István Margitai, Balázs Márkus, Péter Medvegyev, Julia Molnár, Balázs Árpád Szucs, Ágnes Tuza, Tamás Vadász, Kata Váradi, Ágnes Vidovics-Dancs
Regression Analysis by Example, 4th Edition

Regression Analysis by Example, 4th Edition

Samprit Chatterjee, Ali S. Hadi

Publisher Resources

ISBN: 9781788627306Supplemental Content