View source: R/batch_normalization.R
batch_normalization | R Documentation |
This function median normalizes multivariable data often processed in batches, such as metabolomic and proteomic data sets.
batch_normalization( wdata, feature_data_sheet = NULL, sample_data_sheet = NULL, feature_runmode_col = NULL, batch_ids = NULL )
wdata |
the metabolite data frame samples in row, metabolites in columns |
feature_data_sheet |
a data frame containing the feature annotation data |
sample_data_sheet |
a data frame containing the sample annotation data |
feature_runmode_col |
a string identifying the column name in the feature_data_sheet that identifies the run mode for each feature (metabolites of proteins). |
batch_ids |
a string vector, with a length equal to the number of samples in the data set that identifies what batch each sample belongs to. |
returns the wdata object passed to the function median normalized given the batch information provided.
#################################### ## with a vector of batch variables #################################### ## define the data set d1 = sapply(1:10, function(x){ rnorm(25, 40, 2) }) d2 = sapply(1:10, function(x){ rnorm(25, 35, 2) }) ex_data = rbind(d1,d2) rownames(ex_data) = paste0("ind", 1:nrow(ex_data)) colnames(ex_data) = paste0("var", 1:ncol(ex_data)) ## define the batch batch = c( rep("A", 25), rep("B", 25) ) ## normalize by batch norm_wdata = batch_normalization(wdata = ex_data, batch_ids = batch )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.