removeNA | R Documentation |
Replaces NA values in a numeric vector with the mean of non-NA values. Issues a warning if the proportion of NA values exceeds 5
removeNA(x)
x |
A numeric vector containing NA values |
The function: * Calculates the proportion of NA values in the input vector * Issues a warning if more than 5 * Replaces all NA values with the mean of non-NA values
A numeric vector with NA values replaced by the mean
x <- c(1, 2, NA, 4, NA, 6)
removeNA(x) # Returns c(1, 2, 3.25, 4, 3.25, 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.