View source: R/normalization.R
alr | R Documentation |
The additive log-ratio transformation for compositional data (not necessarily closed/normalized!)
alr(x, ...) ## Default S3 method: alr( x, divcomp = 1, base = exp(1), removeDivComp = TRUE, tol = .Machine$double.eps ) ## S3 method for class 'matrix' alr( x, mar = 2, divcomp = 1, base = exp(1), removeDivComp = TRUE, tol = .Machine$double.eps ) ## S3 method for class 'data.frame' alr(x, mar = 2, ...)
x |
a numeric data vector containing components of a composition |
... |
additional arguments |
divcomp |
index of the divisor component |
base |
base of log to use, default is natural log |
removeDivComp |
remove divisor component from the resulting data |
tol |
machine tolerance for a zero count, default is machine tol (.Machine$double.eps) |
The alr transformation is computed as:
x[i]
= log ( x[i]
/ x[D] )
alr transformed x
# vector examples: alr(norm_to_total(1:10)) alr(1:10) # matrix examples: dmat <- matrix(exp(rnorm(110)), 10) alr(dmat, 1) alr(dmat, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.