View source: R/corrupt_mat_randomly.R
corrupt_mat_randomly | R Documentation |
corrupt_mat_randomly
corrupts a given data matrix by knocking out a random
specified percentage of entries as NA
missing values.
corrupt_mat_randomly(mat, k, perc_b)
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. |
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.
corrupt_mat
mat <- matrix(rnorm(25), 5, 5) corrupted_mat <- corrupt_mat_randomly(mat, k = 1, perc_b = .2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.