Description Usage Arguments See Also Examples
simp is a useful function to quickly impute missing values with naive methods.
1 | simp(x, method = "mean")
|
x |
vector |
method |
method of imputation, possible values are "mean", "median", "zero" or "flag". |
to apply more sophisticated imputations see packages mice, missForest, Hmisc, mi and norm
1 2 3 4 5 6 7 8 9 10 11 12 | # impute airquaity ozone data
anyNA(airquality$Ozone)
ozone <- simp(airquality$Ozone)
anyNA(ozone)
# impute the entire airquality dataset with mean (default method)
airquality2 <- apply(airquality, 2, simp)
anyNA(airquality2)
# impute with the median
airquality3 <- apply(airquality, 2, function(x) simp(x, "median"))
anyNA(airquality3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.