Description Usage Arguments Value Examples
View source: R/replace_missing_values.R
Sanitize different representations of missing values (e.g., zeroes,
NaN
s, or infinite values) in a chromatogram matrix, then optionally
replace them all with zeroes or with near-zero noise.
1 2 3 4 5 | replace_missing_values(
mat,
missing = c("NA", "zero", "noise"),
noise_floor = 0.001
)
|
mat |
a CF-MS chromatogram matrix, with proteins in rows and fractions in columns |
missing |
one of |
noise_floor |
upper limit of the uniform distribution for
|
a copy of the input matrix with missing values optionally replaced
1 2 3 4 5 6 7 8 | mat = matrix(rnorm(100), ncol = 10, nrow = 10,
dimnames = list(paste0('protein_', LETTERS[1:10]),
paste0('fraction_', seq_len(10))))
mat[sample(seq_along(mat), 5)] = 0
mat[sample(seq_along(mat), 8)] = NA
mat[sample(seq_along(mat), 2)] = Inf
sanitized = replace_missing_values(mat, missing = 'zero')
table(sanitized == 0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.