Learn R Programming

ClustImpute (version 0.2.4)

miss_sim: Simulation of missings

Description

Simulates missing at random using a normal copula to create correlations between the missing (type="MAR"). Missings appear in each column of the provided data frame with the same ratio.

Usage

miss_sim(dat, p = 0.2, type = "MAR", seed_nr = 123)

Arguments

dat

Data frame with only numeric values

p

Fraction of missings (for entire data frame)

type

Type of missingness. Either MCAR (=missing completely at random) or MAR (=missing at random)

seed_nr

Number for set.seed()

Value

data frame with only numeric values and NAs

Examples

Run this code
# NOT RUN {
data(cars)
cars_with_missings <- miss_sim(cars,p = .2,seed_nr = 4)
summary(cars_with_missings)

# }

Run the code above in your browser using DataLab