impute | R Documentation |
Impute NA values for each row of a matrix.
impute(x, fun = median)
x |
numeric matrix or data.frame that can be converted to a numeric matrix |
fun |
Imputation function to apply to rows of the matrix. Default median |
Matrix with imputed values
# Create a matrix of values with NAs
X <- matrix(runif(25), 5, dimnames = list(paste0("CpG", 1:5), paste0("Sample", 1:5)))
X[sample.int(25, 5)] <- NA
X
# Impute missing values with row medians
impute(X)
# Impute missing values with row mins
impute(X, min)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.