| impute_nas_mean | R Documentation |
Replace missing values in each variable by the mean of the observed values for that variable.
impute_nas_mean(dataset)
dataset |
A dataset object to modify. |
A dataset object with the same structure as the input, where missing values in 'dataset$data' have been replaced by the mean of the corresponding variable calculated with 'na.rm = TRUE'.
data <- matrix(
c(1, NA, 3, 4),
nrow = 2,
dimnames = list(c("x1", "x2"), c("s1", "s2"))
)
dataset <- list(data = data)
impute_nas_mean(dataset)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.