corrupt_mat: Corrupts a data matrix by subjecting specified columns to a...

View source: R/corrupt_mat.R

corrupt_matR Documentation

Corrupts a data matrix by subjecting specified columns to a given limit of detection.

Description

corrupt_mat subjects specified columns of a given data matrix to a given limit of detection (LOD). Follows a given imputation scheme when imputing values below LOD.

Usage

corrupt_mat(mat, cols, limit, fill = "NA")

Arguments

mat

The data matrix to be corrupted.

cols

The columns in the data matrix to subject to an LOD.

limit

The percent of each specified column to put under the LOD. Ex: if limit = 0.25 then the first quartile of each specified column is put under the LOD.

fill

The impute scheme to use for values below LOD. Takes one of the following: "sqrt2", "-1", "mean", "NA", "status" (Default = "NA"). See below for descriptions of each.

Value

The corrupted matrix

Options for fill

"sqrt2"

results in values below the LOD imputed as LOD/sqrt{2}.

"-1"

results in values below the LOD imputed as -1.

"mean"

imputes values below the LOD with the mean of those values below the LOD.

"NA"

replaces values below the LOD with NA missing values.

"status"

is a special option that returns a vector detailing whether or not values are below the given LOD or not.

Note that the LOD is column-specific.

See Also

impute

Examples

mat <- matrix(rnorm(25), 5, 5)
corrupted_mat <- corrupt_mat(mat, cols=1:5, limit=.4, fill="-1")

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