October 2017
Beginner to intermediate
572 pages
26h 1m
English
In any dataset there is always a chance that some values are missing. In R, a missing value is often noted with the NA symbol, which stands for not available. Almost all the functions in R have some way to deal with missing values, for example, the mean or sum function will not work with NA. Consider the following simple example where a vector with missing value NA is created. When we try to find the mean it gives NA as an answer due to NA values in a set. The mean function also supports a parameter na.rm that removes NA from the set and computes the mean:
> t = c(1,2,3,NA,4,5) # Created a vector with missing value> mean(t) # finding mean will give NA [1] NA > mean(t, na.rm = TRUE) # using na.rm = TRUE will work[1] 3
This ...
Read now
Unlock full access