generateNA {missCforest}R Documentation

Generate Missing Values Completely at Random

Description

Introducing a proportion of missing values given a data.frame under Missing Completely at Random mechanism (MCAR).

Usage

generateNA(dat, pmiss = 0.2, seed = 123)

Arguments

dat

complete data.frame.

pmiss

proportion of NA.

seed

seed value to ensure reproducibility.

Value

data.frame with the desired proportion of missing values.

Details

This function is made only for experimental purpose. Whithout specifying the columns (i.e. variables), missing values are introduced to all columns of the dataset.

Examples


data(iris)
# introduce 30% of NA
irisNA <- generateNA(iris, 0.3)
# check the proportion of NA
 mean(is.na(irisNA))

[Package missCforest version 0.0.8 Index]