Description Usage Arguments Value See Also Examples
View source: R/utilities-data-validation.R
Impute uniformly in the range of the provided variable
1 | fillMissing(x, varType, imputeRng = NULL, categories = NULL)
|
x |
Vector with missing values to impute |
varType |
Character specifying the variable type |
categories |
Set of possible categories from which to choose, default NULL |
lower |
Numeric lower bound, default NULL |
upper |
Numeric upper bound, default NULL |
Vector x
with missing values imputed
1 2 3 4 5 6 7 8 9 10 | # numeric example
y <- rnorm(100)
y[sample(1:100, size=10)] <- NA
y_imputed <- fillMissing(x=y, varType='numeric', lower=-1, upper=1)
# categorical example
cats <- as.factor(c('dog', 'zebra', 'bird', 'hippo'))
s <- sample(cats, size=100, replace=TRUE)
s[sample(1:100, size=10)] <- NA
s_imputed <- fillMissing(x=s, varType='factor', categories=cats)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.