The function will impute all NA values with either a given statistic (e.g. median) or with the largest group
Usage
impute_covar(var, uniques = NULL, type = "median", verbose = FALSE)
Value
a vector where missing values are imputed
Arguments
var
vector with the items that should be imputed
uniques
vector that defines unique records to enable calculation of stats on non duplicate values
type
character of length one defining the type of statistics to perform for imputation (see details)
verbose
logical indicating if additional information should be given
Author
Richard Hooijmaijers
Details
The function can be used to impute continuous or categorical covariates. In case continuous covariates the type
argument should be a statistic like median or mean. In case a categorical covariate is used, the type should be set
to 'largest' in which case the category that occurs most is used. In case multiple values occur most, the last encountered
is used.