NormalizeMultiBlock: NARemoveMultiBlock

View source: R/NormalizeMultiBlock.R

NormalizeMultiBlockR Documentation

NARemoveMultiBlock

Description

Normalize all blocks from a multi-block structure. The ranknorm transform is based on that from the RNOmni package (genomedoi:10.1111/biom.13214).

Usage

NormalizeMultiBlock(
  MB = MB,
  blocks = NULL,
  method = c("none", "auto", "mean", "pareto", "norm", "geometric", "ranknorm")[5],
  infinite.as.NA = FALSE,
  constant = 0,
  offset = 3/8,
  showWarning = TRUE
)

Arguments

MB

The multi-blocks structure.

blocks

The blocks to apply the normalization. It can be a vector of integers or a vector with the block names. Facultative.

method

The method to use for data normalization. 'none' will not do any transformation besides replacing the Inf values to NA if infinite.as.NA is set to TRUE. 'auto' stands for auto-scaling, 'mean' for mean-centering, 'pareto' for Pareto transform (mean-centered and divided by the square root of the standard deviation), 'norm' for mean-centered and divided by its norm, 'geometric' for geometric mean transform, and 'ranknorm' for the rank-based inverse normal transform.

infinite.as.NA

If TRUE, Infinite values are converted to NA. The presence of NA or Inf values will cause ComDim to stop, but they can be transformed to numerical values with the functions 'NARemoveMultiBlock' and 'InfRemoveMultiBlock', respectively.

constant

For the 'geometric' method, the value added to each element in the multi-block. The default number is 0.

offset

For the 'ranknorm' method. Defaults to (3/8), correspond to the Blom transform.

showWarning

If TRUE, it will return a warning in case there is any variable with only NAs in the multi-block.

Value

The multi-block

Examples

b1 = matrix(rnorm(500),10,50)
b2 = matrix(rnorm(800),10,80)
b2[c(2,3,5),c(1,2,3)] <- NA
# Build multi-block by adding one data block at a time:
mb <- BuildMultiBlock(b1, newSamples = paste0('sample_',1:10))
mb <- BuildMultiBlock(b2, growingMB = mb)
mb <- NormalizeMultiBlock(mb, method = 'auto')

f-puig/R.ComDim documentation built on Feb. 20, 2024, 6:49 a.m.