PCA: Principal Component Analysis

Description Usage Arguments Details Value Examples

View source: R/PCA.R

Description

A convenience function that conducts a prinicipal components analysis (PCA) on the specified rows and columns of a data frame using R's base function princomp.

Usage

1
2
3
4
5
6
7
8
PCA(
  df,
  rows = NULL,
  columns = NULL,
  patterns = NULL,
  exclude = T,
  retain = NULL
)

Arguments

df

A data frame.

rows

An optional logical vector matching in length to the number of rows in 'df' indicating which rows to use for the PCA.

columns

An optional vector of column names in 'df' to use for the PCA.

patterns

An optional vector of character strings, incomplete patterns to use to identify either columns to include in or columns to exclude from the PCA.

exclude

Logical; if TRUE, the 'patterns' vector are strings to identify columns to exclude; otherwise the 'patterns' vector are strings to identify columns to include.

retain

Description.

Details

Once a PCA has been conducted, prinicipal component scores are computed for all observations.

Value

An object of class 'PCA'.

Examples

1
2
# Example of function
results = PCA( mtcars, patterns = c( 'p', 'r' ) )

rettopnivek/PCAandEFA documentation built on May 4, 2020, 12:08 a.m.