Compute the additive log ratio transform of a (dataset of) composition(s). Default method is function alr from package compositions.

alr(x, ...)

# S3 method for default
alr(x, ivar = ncol(x), ...)

# S3 method for hyperSpec
alr(x, ivar = ncol(x$spc), ...)

Arguments

x

A composition, not necessarily closed. (A numeric data frame or matrix.)

...

further parameters to alr.

ivar

The number of column in x to be used as denominator variable. By default the last column is taken.

Value

Returns the transformed data matrix with one dimension less than

x. Thus for hyperSpec object the last value of x$.wavelength is removed.

See also

alr

Other row-wise transformations: apt(), clr(), cpt(), ilr(), ipt()

Examples

data(Spectra2)
Spectra <- Spectra2[,,300~600]
alr(Spectra)
#> hyperSpec object
#>    150 spectra
#>    3 data columns
#>    300 data points / spectrum

ind <- wl2i(Spectra, 550) # number of column at 550 nm.
alr(Spectra, ind)
#> hyperSpec object
#>    150 spectra
#>    3 data columns
#>    300 data points / spectrum

plot(Spectra)

plot(alr(Spectra))

plot(alr(Spectra, ind))