Exercise

NA

The na_example dataset represents a series of counts. It is included in the dslabs package. You can quickly examine the object using

library(dslabs)
data(na_example)
str(na_example)

However, when we compute the average we obtain an NA. You can see this by typing

mean(na_example)

Instructions

100 XP
  • The is.na returns a logical vector that tells us which entries are NA. Assign the logical vector that is returned by is.na(na_example) to an object called ind.
  • Determine how many NAs na_example has, using the sum command.