add_missingness: Apply MAR missingness to data

Description Usage Arguments Value Examples

View source: R/pre_processing.R

Description

Helper function to re-apply binary variable labels post-imputation.

Usage

1
add_missingness(X, prop, cols = NULL)

Arguments

X

A data.frame or similar

prop

Numeric between 0 and 1; the proportion of observations set to missing

cols

A vector of column names to be corrupted; if NULL, all columns are used

Value

Data with missing values

Examples

1
2
3
4
whole_data <- data.frame(a = rnorm(1000),
                        b = rnorm(1000))

missing_data <- add_missingness(whole_data, 0.1)

rMIDAS documentation built on Jan. 30, 2021, 9:05 a.m.