Skip to contents

Perform principal component analysis (PCA) on specified variables and create visualizations.

Usage

CreatePCATable(
  Data,
  VarsToReduce,
  VariableCategories = NULL,
  minThresh = 0.85,
  scale = TRUE,
  center = TRUE,
  Relabel = T,
  Ordinal = FALSE,
  numComponents = NULL
)

Arguments

Data

The dataset containing the variables for PCA.

VarsToReduce

A character vector specifying the variables to include in the PCA.

VariableCategories,

categorical, annotates the lollipop plot with color

minThresh

The minimum threshold for cumulative proportion of variance (default is 0.85).

scale

Logical, indicating whether to scale the data (default is TRUE).

center

Logical, indicating whether to center the data (default is TRUE).

Relabel

Optional argument to relabel the components.

Ordinal

Logical, indicating whether ordinal variables should be handled.

numComponents

Number of principal components to compute.

Value

A list containing PCA results and visualizations.