major: Majority imputation for a vector

Description Usage Arguments Value Examples

View source: R/funs.R

Description

This function is internally used by guess, it may be useless in reality.

Usage

1
major(x)

Arguments

x

a character (or numeric categorical) vector with missing values

Value

the same length of vector with missing values being imputed by the majority class in this vector.

Examples

1
2
3
4
5
a <- c(rep(0, 10), rep(1, 15), rep(2, 5))
a[sample(seq_along(a), 5)] <- NA
a
b <- major(a)
b

SteffenMoritz/imputeR documentation built on July 24, 2021, 9:25 p.m.