Session Ready
Exercise

Cleaning your data

Since we have some missing data on weight gain, we'll first create a cleaned-up version of the weight gain variable, and use this variable in the next few steps of the analysis.

There are many ways of accomplishing this task in R, we'll do it using the na.omit() function. The command na.omit(a_data_set) returns a_data_set stripped of its (possible) NA values.

We'll also store the sample size of the clean data set (which should be less than 1000 since we dropped the observations with NAs) in order to be able to use this value in the next few steps of the analysis as well.

Instructions
100 XP
  • Create a clean version gained_clean of nc$gained using the function na.omit().
  • Store the length of gained_clean in n by using the length() function.