tran {analogue}R Documentation

Common data transformations and standardizations

Description

Provides common data transformations and standardizations useful for palaeoecological data. The function acts as a wrapper to function decostand in package vegan for several of the available options.

The formula method allows a convenient method for selecting or excluding subsets of variables before applying the chosen transformation.

Usage

## Default S3 method:
tran(x, method, a = 1, b = 0, p = 2, base = exp(1),
     na.rm = FALSE, na.value = 0, ...)

## S3 method for class 'formula'
tran(formula, data = NULL, subset = NULL,
     na.action = na.pass, ...)

Arguments

x

A matrix-like object.

method

transformation or standardization method to apply. See Details for available options.

a

Constant to multiply x by. method = "log" only. Can be a vector, in which case the vector of values to multiply each column of x by.

b

Constant to add to x before taking logs. method = "log" only. Can be a vector, in which case the vector of values to add to each column of x.

p

The power to use in the power transformation.

base

the base with respect to which logarithms are computed. See log for further details. The default is to compute natural logarithms.

na.rm

Should missing values be removed before some computations?

na.value

The value with which to replace missing values (NA).

...

Arguments passed to decostand, or other tran methods.

formula

A model formula describing the variables to be transformed. The formula should have only a right hand side, e.g.~~ foo + bar.

data, subset, na.action

See model.frame for details on these arguments. data will generally be the object or environment within which the variables in the forumla are searched for.

Details

The function offers following transformation and standardization methods for community data:

Value

Returns the suitably transformed or standardized x. If x is a data frame, the returned value is like-wise a data frame. The returned object also has an attribute "tran" giving the name of applied transformation or standardization "method".

Author(s)

Gavin L. Simpson. Much of the functionality of tran is provided by decostand, written by Jari Oksanen.

References

Aitchison, J. (1983) Principal components analysis of compositional data. Biometrika 70(1); 57–65.

Field, J.G., Clarke, K.R., & Warwick, R.M. (1982) A practical strategy for analysing multispecies distributions patterns. Marine Ecology Progress Series 8; 37–52.

Legendre, P. & Gallagher, E.D. (2001) Ecologically meaningful transformations for ordination of species data. Oecologia 129; 271-280.

Oksanen, J. (1983) Ordination of boreal heath-like vegetation with principal component analysis, correspondence analysis and multidimensional scaling. Vegetatio 52; 181-189.

See Also

decostand

Examples

data(swapdiat)
## convert percentages to proportions
sptrans <- tran(swapdiat, "pcent2prop")

## apply Hellinger transformation
spHell <- tran(swapdiat, "hellinger")

## Dummy data to illustrate formula method
d <- data.frame(A = runif(10), B = runif(10), C = runif(10))
## simulate some missings
d[sample(10,3), 1] <- NA
## apply tran using formula
tran(~ . - B, data = d, na.action = na.pass,
     method = "missing", na.value = 0)

[Package analogue version 0.17-6 Index]