imputeMissings: Impute missing values with the median or mode.

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/imputeMissings.R

Description

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

Usage

1

Arguments

data

A data frame.

Value

A data frame.

Author(s)

Dirk Van den Poel, Michel Ballings, Andrey Volkov, Jeroen D”haen, Michiel Van Herwegen

Maintainer: Michel Ballings <Michel.Ballings@GMail.com>

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

1
2
3
4
5
6
#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)

Example output

aCRM 0.1.1
Type aCRMNews() to see the change log
   V1 V2  V3  V4
1 yes  1 1.0 1.0
2  no  2 2.0 2.0
3  no  3 3.0 3.0
4 yes  4 4.0 4.0
5 yes  4 5.0 5.0
6 yes  4 6.0 6.0
7 yes  4 3.5 3.5

aCRM documentation built on May 1, 2019, 8:29 p.m.