tran {analogue}R Documentation

Common data transformations and standardizations


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.


## 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, ...)



A matrix-like object.


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


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.


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.


The power to use in the power transformation.


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


Should missing values be removed before some computations?


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


Arguments passed to decostand, or other tran methods.


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.


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


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".


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


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



## 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]