# Analysis of community ecology data in R

David Zelený

### Others

You are not allowed to perform this action
en:pca_r

Section: Ordination analysis

## PCA & tb-PCA (linear unconstrained ordination)

### R functions

• rda (library vegan) - if the environmental data matrix in this function is not specified, the rda function from package vegan performs unconstrained ordination (PCA). To calculate tb-PCA, first pre-transform the compositional data (using decostand from vegan, with argument method either hellinger or chord) and then use rda function. Function plot draws ordination diagram, but species are drawn like centroids, not like vectors (the same in function ordiplot); use biplot (library vegan) to draw variables as vectors, or consider using function cleanplot.pca (from Numerical Ecology with R, definition here), which is intended for drawing PCA results.
• prcomp and princomp- functions, which are a part of preinstalled library stats. Beware: plot function does not draw ordination diagram, but draws the barplot with eigenvalues (but you can use functions ordiplot or biplot from vegan package instead).
• pca (library labdsv) - another option, how to calculate pca. The library labdsv provides its own plot.pca and other (e.g. points.pca) functions, because the results of pca function are not compatible with ordiplot from vegan.
• PCA (P. Legendre in Numerical Ecology with R) - custom build function (called PCA.newr in the second edition), with biplot for ploting. You can find the definition here.

applied on the object returned by vegan's function rda.

• ordiequilibriumcircle (library BiodiversityR) - adds the circle of equivalent contribution onto the ordination diagram plotted by vegan's functions ordiplot or biplot. Note that the ordination diagram needs to be stored into an object, and the name of this object needs to come in the argument ordiplot of this function.