Learn R Programming

GenForImp (version 1.0)

missing.gen0: Generating random missing values on a data matrix

Description

The function generates a number of missing values (NA) completely at random on a data matrix.

Usage

missing.gen0(mat, nummiss)

Arguments

mat
a matrix of numerical data.
nummiss
number of missing values.

Value

The data matrix with missing values (NA).

Details

The function generates a number of missing values (NA) completely at random on a data matrix.

See Also

missing.gen

Examples

Run this code
sigma <- matrix(0.4, 4, 4)
diag(sigma) <- 1
x0 <- rmvnorm(n=100, mean=rep(0, 4), sigma=sigma)
x0 # complete matrix
x <- missing.gen0(x0, 50)
x # matrix with 50 missing values

Run the code above in your browser using DataLab