mi: Create missing data indicators

Description Usage Arguments Value Examples

View source: R/mi.R

Description

Create scores: mean or if any of the variables have specific values.

Usage

1
mi(dat, vars)

Arguments

dat

'data.table' object.

vars

Character vector with name of variables.

Value

'data.table' with indicator variables. Missing data are replaced by the mean (numeric and interger) and the mode (factors).

Examples

1
2
3
4
5
6
a <- c(NA,2,3,4, NA)
b <- c(2,3,4,NA, 3)
c <- c(1,2,3,NA, 1)
dat <- data.table(a,b,c)
vars <- names(dat)
mi(dat, vars)

sdaza/sdazar documentation built on May 29, 2019, 4:20 p.m.