Introduction to R – Removing missing values

January 11, 2013    R Programming Language Statistics

A common task in preparing you data is to remove missing values(NAs). One way to do that is to retrieve a vector of the missing values in your data, and then filter them out from your structure.

If you want to filter out the missing values from more than one vector , you can use complete.cases() to get the indices that contains good data in both vectors.

Here good will contain TRUE only for indices that hold good data in both vectors; FALSE otherwise. complete.cases() works with data frames also. In that case it removes any row that contains NA in any column.The returned data frame will not contain any NAs.
Stay tuned for more R notes.



comments powered by Disqus