PCAmyDF: Principal Component Analysis (PCA) Plot

PCAmyDFR Documentation

Principal Component Analysis (PCA) Plot

Description

This function generates a PCA plot using the prcomp function in R.

Usage

PCAmyDF(
  dfx,
  labels,
  factorV,
  title = "PCA Plot",
  scale,
  center,
  col_vector,
  namePointBL = F
)

Arguments

dfx

a numeric matrix containing the data to be plotted

labels

a character vector containing the labels for each sample in dfx

factorV

a factor or character vector indicating the group each sample belongs to

title

a character string specifying the title of the plot

scale

a logical value indicating whether the variables should be scaled to have unit variance

center

a logical value indicating whether the variables should be centered

col_vector

a vector of color names to be used for plotting the samples

namePointBL

a logical value indicating whether to include labels for each point

Value

If returnPCA is TRUE, the function returns a list containing the PCA results. Otherwise, the function generates a PCA plot.

Examples

data("iris")
PCAmyDF(iris[,1:4], iris$Species, iris$Species, "Iris dataset", TRUE, TRUE, c("red", "blue", "green"), TRUE)


eisascience/scCustFx documentation built on June 2, 2025, 3:59 a.m.