Learn R Programming

aCRM (version 0.1.1)

imputeMissings: Impute missing values with the median or mode.

Description

Character vectors and factors are imputed with the mode. Numeric and integer vectors are imputed with the median.

Usage

imputeMissings(data)

Arguments

data
A data frame.

Value

A data frame.

References

Van den Poel, D., Ballings, M., Volkov, A., D''haen, J., Van Herwegen, M., Predictive Analytics for analytical Customer Relationship Management using SAS, Oracle and R, Springer, Forthcoming.

See Also

Other functions in this package: imputeMissings, Aggregate, cocktailEnsemble, predict.cocktailEnsemble

Examples

Run this code
#create some data
data <- data.frame(V1=as.factor(c('yes','no','no',NA,'yes','yes','yes')),
                   V2=as.character(c(1,2,3,4,4,4,NA)),
                   V3=c(1:6,NA),V4=as.numeric(c(1:6,NA)))
#demonstrate function
imputeMissings(data)

Run the code above in your browser using DataLab