PCA: Principal Component Analysis

View source: R/PCA.r

PCAR Documentation

Principal Component Analysis

Description

Function that performs principal component analysis on an abundance matrix.

Usage

PCA(x, cor, dim)

## Default S3 method:
PCA(x, cor = FALSE, dim = min(nrow(x), ncol(x)))

## S3 method for class 'Dataset'
PCA(x, cor = FALSE, dim = min(nrow(x$Tab), ncol(x$Tab)))

Arguments

x

Numeric matrix where samples are columns and rows are species, or a Dataset object, see create_dataset.

cor

logical value indicating whether the correlation matrix should be used instead of the covariance matrix.

dim

Number of dimensions to return.

Details

This function is the same as function pca from the labdsv package, but includes a methdod for Dataset objects.

Value

A PCA object. Includes the same attributes as a pca object from the labdsv package. When the Dataset method is used, it includes two additional slots:

  • "Map"The Mapping file for the samples.

  • "Tax"The Taxonomic information of the taxa.

Author(s)

Sur from Dangl Lab.

See Also

create_dataset, pca, PCO, pco, plotgg.pca

Examples

data(Rhizo)
data(Rhizo.map)
Dat <- create_dataset(Rhizo,Rhizo.map)
Dat.pca <- PCA(Dat)
plotgg(Dat.pca,col="accession",shape="fraction",point_size=4,biplot=TRUE)
summary(Dat.pca)

surh/AMOR documentation built on Feb. 21, 2023, 6:31 a.m.