corrupt_mat_randomly: Corrupts a data matrix by knocking out a random specified...

View source: R/corrupt_mat_randomly.R

corrupt_mat_randomlyR Documentation

Corrupts a data matrix by knocking out a random specified percentage of entries.

Description

corrupt_mat_randomly corrupts a given data matrix by knocking out a random specified percentage of entries as NA missing values.

Usage

corrupt_mat_randomly(mat, k, perc_b)

Arguments

mat

The data matrix to be corrupted.

k

The random seed to use.

perc_b

The percentage of the entries in the data matrix to be corrupted.

Value

A list containing the corrupted matrix (named cor.mat), along with a binary matrix (named cor.mask) where 1's identify entries that were corrupted, and 0 identify entries that were left untouched.

See Also

corrupt_mat

Examples

mat <- matrix(rnorm(25), 5, 5)
corrupted_mat <- corrupt_mat_randomly(mat, k = 1, perc_b = .2)

Columbia-PRIME/PCPhelpers documentation built on April 24, 2022, 7:57 p.m.