Description Usage Arguments Value See Also Examples
impute_mode
returns a vector of values imputed from the mode(s) of x
.
1 | impute_mode(x, n = 1, tiebreaker = "random")
|
x |
A vector. |
n |
The number of values to impute. Only relevant when when there is not a unique mode. |
tiebreaker |
How to break "ties" if there is not a single unique mode. The default is "random", which samples randomly with replacement from the different modes. |
The output of impute_mode
is a vector of imputed values of length n
Other imputers: impute_ecdf
,
impute_sample
, impute
1 2 3 4 5 6 7 | x <- c("mode", "mode", "other", NA, NA)
# Impute mode
x_impute <- impute(x, impute_mode)
# Compare
data.frame(x, x_impute)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.