Normalize Raw Data

LogNormalize(data, scale.factor = 10000, margin = 2L, verbose = TRUE, ...)

# S3 method for data.frame
LogNormalize(data, scale.factor = 10000, margin = 2L, verbose = TRUE, ...)

# S3 method for V3Matrix
LogNormalize(data, scale.factor = 10000, margin = 2L, verbose = TRUE, ...)

# S3 method for default
LogNormalize(data, scale.factor = 10000, margin = 2L, verbose = TRUE, ...)

Arguments

data

Matrix with the raw count data

scale.factor

Scale the data; default is 1e4

margin

Margin to normalize over

verbose

Print progress

...

Arguments passed to other methods

Value

A matrix with the normalized and log-transformed data

Examples

mat <- matrix(data = rbinom(n = 25, size = 5, prob = 0.2), nrow = 5)
mat
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    0    0    2    2    0
#> [2,]    2    0    1    2    1
#> [3,]    3    0    1    0    0
#> [4,]    1    1    3    1    1
#> [5,]    1    1    1    0    2
mat_norm <- LogNormalize(data = mat)
mat_norm
#>          [,1]     [,2]     [,3]     [,4]     [,5]
#> [1,] 0.000000 0.000000 7.824446 8.294300 0.000000
#> [2,] 7.957927 0.000000 7.131699 8.294300 7.824446
#> [3,] 8.363276 0.000000 7.131699 0.000000 0.000000
#> [4,] 7.265130 8.517393 8.229778 7.601402 7.824446
#> [5,] 7.265130 8.517393 7.131699 0.000000 8.517393