Skip to contents

Performs a principal components analysis on the Metabolite object.

Usage

run_PCA(
  object,
  nPCs = 10,
  impute_method = "half-min",
  log = TRUE,
  scale = TRUE,
  addPC = TRUE
)

Arguments

object

A Metabolite object.

nPCs

Number of principal components to be calculated. Default value 10.

impute_method

Imputation method, the default method is half the minimum value (`half-min`) of the metabolite. Currently support 'half-min', "median", "mean", "zero". `NULL` without imputation.

log

Performs natural logarithm transformation before PCA analysis.

scale

scale feature in the PCA calculation.

addPC

If TRUE, merge PCs with `@sampleData` and return the `object`, else return `PC`.

Value

A list of PCs and variances explained.

Examples

data(df_plasma)
d <- run_PCA(df_plasma)