iobr_pca: Principal Component Analysis (PCA) Visualization

View source: R/iobr_pca.R

iobr_pcaR Documentation

Principal Component Analysis (PCA) Visualization

Description

The iobr_pca function performs Principal Component Analysis (PCA), which reduces the dimensionality of data while maintaining most of the original variance, and visualizes the PCA results on a scatter plot.

Usage

iobr_pca(
  data,
  is.matrix = TRUE,
  scale = TRUE,
  is.log = FALSE,
  pdata,
  id_pdata = "ID",
  group = NULL,
  geom.ind = "point",
  cols = "normal",
  palette = "jama",
  repel = FALSE,
  ncp = 5,
  axes = c(1, 2),
  addEllipses = TRUE
)

Arguments

data

The input data for PCA. It should be a matrix or a data frame.

is.matrix

Specifies whether the input data is a matrix. Default is TRUE.

scale

Specifies whether to scale the input data. Default is TRUE.

is.log

Specifies whether to log transform the input data. Default is FALSE.

pdata

Data frame containing sample ID and grouping status.

id_pdata

The column name in 'pdata' that represents the ID for matching with 'data'. Default is "ID".

group

The column name in 'pdata' that represents groups/categories to color the points. Default is NULL.

geom.ind

The type of geometric representation for the points in the PCA plot. Default is "point".

cols

The color scheme to be used for group categories. Default is "normal".

palette

The color palette to be used for group categories. Default is "jama".

repel

Specifies whether to repel the data points to avoid overlap. Default is FALSE.

ncp

The number of dimensions to keep in the PCA. Default is 5.

axes

The dimensions/axes to be plotted. Default is c(1, 2).

addEllipses

Specifies whether to add concentration ellipses to the plot. Default is TRUE.

Author(s)

Dongqiang Zeng

Examples

data("eset_stad", package = "IOBR")
eset <- count2tpm(eset_stad)
iobr_pca(eset, is.matrix = TRUE, scale = TRUE, is.log = TRUE, pdata = stad_group, id_pdata = "ID", group = "subtype")


IOBR/IOBR documentation built on May 5, 2024, 2:34 p.m.