View source: R/median_impute.R
median_impute | R Documentation |
This function imputes features (columns) of a metabolome matrix to median estimates. Useful for PCA.
median_impute(wdata)
wdata |
the metabolite data matrix. samples in row, metabolites in columns |
the matrix passed to the function but with NA's imputed to each columns median value.
ex_data = sapply(1:100, function(x){ rnorm(250, 40, 5) }) ## define the data set rownames(ex_data) = paste0("ind", 1:nrow(ex_data)) colnames(ex_data) = paste0("var", 1:ncol(ex_data)) ## add in some missingness ex_data[sample(1:length(ex_data), 500)] = NA ## Estimate missingness and generate plots imp_data = median_impute(ex_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.