impute | R Documentation |
Cleans numeric columns by handling extreme values or imputing missing values. The function supports two main focuses: handling skewed distributions or imputing missing data.
impute(
x,
focus = c("skew", "missing"),
method = c("winsorize", "iqr", "mean", "median"),
percentile = NULL
)
x |
A numeric vector to be cleaned. |
focus |
A character string indicating the focus. Options are:
|
method |
A character string specifying the method:
|
percentile |
A numeric value (percentile > 0) for winsorization. If not provided, defaults to 0.01 and 0.99. |
A numeric vector with cleaned or imputed values.
x <- c(1, 2, 3, 100, 200, NA)
# Winsorize to 1% and 99%
impute(x, focus = "skew", method = "winsorize")
# Replace missing values with the mean
impute(x, focus = "missing", method = "mean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.