Last chance! 50% off unlimited learning
Sale ends in
Impute the mean value into a vector with missing values
impute_mean(x)# S3 method for default
impute_mean(x)
# S3 method for factor
impute_mean(x)
vector with mean values replaced
vector
vec <- rnorm(10)
vec[sample(1:10, 3)] <- NA
impute_mean(vec)
Run the code above in your browser using DataLab