PCA_function: Analysis: Principal components analysis

View source: R/pca_function.R

PCA_functionR Documentation

Analysis: Principal components analysis

Description

This function performs principal component analysis.

Usage

PCA_function(
  data,
  scale = TRUE,
  text = TRUE,
  pointsize = 5,
  textsize = 12,
  labelsize = 4,
  linesize = 0.6,
  repel = TRUE,
  ylab = NA,
  xlab = NA,
  groups = NA,
  sc = 1,
  font.family = "sans",
  theme = theme_bw(),
  label.legend = "Cluster",
  type.graph = "biplot"
)

Arguments

data

Data.frame with data set. Line name must indicate the treatment

scale

Performs data standardization (default is TRUE)

text

Add label (default is TRUE)

pointsize

Point size (default is 5)

textsize

Text size (default is 12)

labelsize

Label size (default is 4)

linesize

Line size (default is 0.8)

repel

Avoid text overlay (default is TRUE)

ylab

Names y-axis

xlab

Names x-axis

groups

Define grouping

sc

Secondary axis scale ratio (default is 1)

font.family

Font family (default is sans)

theme

Theme ggplot2 (default is theme_bw())

label.legend

Legend title (when group is not NA)

type.graph

Type of chart (default is biplot)

Details

The type.graph argument defines the graph that will be returned, in the case of "biplot" the biplot graph is returned with the first two main components and with eigenvalues and eigenvectors. In the case of "scores" only the treatment scores are returned, while for "cor" the correlations are returned. For "corPCA" a correlation between the vectors with the components is returned.

Value

The eigenvalues and eigenvectors, the explanation percentages of each principal component, the correlations between the vectors with the principal components, as well as graphs are returned.

Author(s)

Gabriel Danilo Shimizu

Examples

data(pomegranate)
medias=tabledesc(pomegranate)
PCA_function(medias)

AgroR documentation built on May 29, 2024, 4:18 a.m.