Great! All missing values in the data frame are now encoded as
NAs. It seems that our data frame is ready for the next step.
NAs are difficult to work with. A common solution, especially if there are few missing values in the data set, is to remove rows with missing values. If we want to remove rows with missing values, we have two options. First, we can use the
complete.cases() function, which returns a
FALSE vector based on the row numbers. If there is at least one
NA in a row, the function will return
FALSE for that row. Let's check this out.