Description Usage Arguments Details Value References Examples
Principle components are calculated on the centerted log ratio tranformation of the OTU table using the prcomp function from the stats package. Scaling the OTU table to a unit variance is the default option, and recommended, but this can be changed using scaled = F. The components are then plotted using the ggbiplot function, available on github
1 2 3 4 5 6 7 8 9 10 11 12 |
micro_set |
A tidy_micro data set |
table |
OTU table of interest |
dist |
A distance matrix, such as a beta diversity. If supplied a PCoA plot will be returned |
grp_var |
Categorical grouping variable for color |
y |
Value to calculate principle components on. Default is centered log ratio |
scale |
Logical. Indicating whether the variables should be scaled to have unit variance before the analysis takes place |
axes_arrows |
Logical. Plot component axes arrows |
main |
Plot title |
subtitle |
Plot subtitle |
legend_title |
Legend title |
PCA calculation is done by a singular value decomposition of the (centered and possibly scaled) data matrix, not by using eigen on the covariance matrix. This is generally the preferred method for numerical accuracy. Calculations are accomplished through the prcomp function, and ggplot is created through the ggbiplot function
A ggplot you can add geoms to if you'd like
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Mardia, K. V., J. T. Kent, and J. M. Bibby (1979) Multivariate Analysis, London: Academic Press.
Venables, W. N. and B. D. Ripley (2002) Modern Applied Statistics with S, Springer-Verlag.
Vincent Q. Vu (2011). ggbiplot: A ggplot2 based biplot. R package version 0.55. http://github.com/vqv/ggbiplot
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.