modeimp: Mode imputation

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

View source: R/modeimp.R

Description

Mode imputation

Usage

1
modeimp(mat)

Arguments

mat

A matrix of categorical or ordinal values, coded as integer values (1, 2, 3, ...)

Details

The function implements the mode imputation on a matrix of categorical or ordinal data with missing values. The function substitutes to each missing value the mode of the corresponding variable.

Value

The imputed matrix

Author(s)

Alessandro barbiero, Giancarlo Manzi, Pier Alda Ferrari

See Also

medianimp, modeimp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(1)
n<-10
m<-3
mat<-matrix(ceiling(runif(n*m)*4),n,m)
matm<-mat
matm[1,3]<-NA
matm[9:10,1]<-NA
# matrix with missing values
matm
# imputed matrix
modeimp(mat)
# original matrix with no missing values
mat


ForImp documentation built on May 19, 2017, 8:32 p.m.
Search within the ForImp package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.