Learn R Programming

SensoMineR (version 1.03)

pca: Principal components analysis

Description

Performs a PCA and returns the individuals factor map and the variables factor map.

Usage

pca(df, supind = NULL, supvar = NULL,
   row.w = rep(1,nrow(df)-length(supind))/(nrow(df)-length(supind)),
   scale.unit = TRUE, coord = c(1,2), graph = TRUE, 
   main.title = NULL, clabel = 1, cex = 0.7, font = 1, csub = 1, 
   col = "black", lty = 1)

Arguments

df
a data frame with n rows (individuals) and p columns (numeric variables)
supind
indexes of the illustrative individuals
supvar
indexes of the illustrative variables
row.w
an optional row weights (by default, uniform row weights)
scale.unit
a boolean, if TRUE (value set by default) then data are scaled to unit variance
coord
a length 2 vector specifying the components to plot
graph
boolean, if TRUE a graph is displayed
main.title
the title of the graph
clabel
if not NULL, a character size for the labels, used with par("cex")*clabel
cex
cf. function par in the graphics package
font
cf. function par in the graphics package
csub
a character size for the legend, used with par("cex")*csub
col
color of the variables
lty
line type of the arrows

Value

  • Returns a list including:
  • eiga numeric vector with the all eigenvalues
  • lia matrix with the coordinates of rows
  • coa matrix with the coordinates of columns
  • lisupa matrix with the coordinates of illustrative rows
  • cosupa matrix with the coordinates of illustrative columns
  • Returns the individuals factor map and the variables factor map.

Examples

Run this code
data(chocolates)
resaverage<-averagetable(chocolates, formul = "~Product+Panelist", 
    firstvar = 5)
pca(resaverage, scale.unit = TRUE)

Run the code above in your browser using DataLab