Description Usage Arguments Examples
Replaces NA values in a vector according to a given method. Specific non-NA values can be considered as NA, if given in as_na.
1 | replace_na(x, as_na = c(NULL), method = NULL)
|
x |
Numeric or Character/factor vector. |
as_na |
Numeric or Character, specifies values that may be considered as NA. |
method |
Character, the method used for choosing the replacement ("NULL", "random", "mode", "normal"). Accepts numeric value if x is numeric. Method must be compatible with x class. |
1 2 3 4 5 6 7 8 9 | ## Not run:
replace_na(c(1, 2, NA, 4, 5, 6), method = 3)
replace_na(c(1, 3.5, 9, 2.8, 5.6, 10.4, 0.7, 2.4, 5.5, NA), method = "normal")
replace_na(c(1, 3.5, 9, 2.8, 5.6, 10.4, 0.7, 2.4, 5.5, NA), method = "random")
replace_na(c("A", "B", "A", "F", "K", "B", "O", "A"), method = "mode")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.