March 2018
Beginner to intermediate
570 pages
13h 42m
English
This method, also called list-wise deletion, is a straightforward procedure that simply removes all rows or elements containing missing values prior to the analysis. In the univariate case—taking the mean of the drat column, for example—all elements of drat that are missing would simply be removed:
mean(miss_mtcars$drat) [1] NA mean(miss_mtcars$drat, na.rm=TRUE) [1] 3.63
In a multivariate procedure—for example, linear regression predicting mpg from am, wt, and qsec—all rows that have a missing value in any of the columns included in the regression are removed:
listwise_model <- lm(mpg ~ am + wt + qsec, data=miss_mtcars, na.action = na.omit) ## OR # complete.cases returns a boolean vector comp <- complete.cases(cbind(miss_mtcars$mpg, ...