pmfpca: pmfpca

View source: R/pmf-pca.R

pmfpcaR Documentation

pmfpca

Description

perform principle compponent analysis on ramclustR object dataset, export plots

Usage

pmfpca(
  ramclustObj = RC,
  which.data = "SpecAbund",
  scale = "pareto",
  subset = c(),
  subset.cmpd = c(),
  which.factors = NULL,
  num.factors = NULL,
  label.by = "cmpd",
  npc = "auto",
  bw = FALSE,
  ag.summary.plot = FALSE
)

Arguments

ramclustObj

ramclustR object to perform PCA on

which.data

character; which dataset (SpecAbund or SpecAbundAve) to perform PCA on.

scale

character; default = 'pareto'. will also accept 'uv' or 'none'

subset

character or integer vector; if character, must be even length. If you wish to perform PCA only when your factor called 'treatment' is a 'trt' sample and when 'time' is '3', then you would use i.e. c("treatment", "trt", "time", "3"). vector length must always be even, and with 'factor' followed by 'level'. If an integer vector is provided, only row numbers matching those integers are retained.

which.factors

character vector; i.e. which.factors = c("treatment", "time"). which factors should be used for coloring PCA plots?

num.factors

which factors should be treated as numeric? must be subset of 'which.factors'. i.e. c("time")

label.by

how should metabolites columns be labelled? one of 'ann' or 'cmpd', typically.

npc

"auto" by default (recommended). This will autoselect number of PCs to use. Can also be set to any integer value to force more PCs.

Details

This function uses the native prcomp() function in R to perform PCA analysis.

Automatic selection of the number of principle components using the AuerGervini method is enabled by the PCDimension and ClassDiscovery packages.

R PCA AuerGervini objects are attached to the ramclustR object, and summary plots and csv files are written to the stats/pca directory in the working directory

a methods narrative is also appended to the $history slot

Value

returns a ramclustR object. new R object in $pca slot. Optionally, new R object in $AuerGervini slot if npc = "auto".

Author(s)

Corey Broeckling


cbroeckl/csu.pmf.tools documentation built on Jan. 26, 2024, 6:27 p.m.