Skip to contents

# runPCA

Source: `R/dim_reduction.R`
`runPCA.Rd`

Performs a Principal Component Analysis (PCA) on the expression matrix specified in `data_slot`.

## Usage

    runPCA(
      fcd,
      data_slot = "orig",
      seed = 91,
      prefix = NULL,
      markers = colnames(fcd$expr[["orig"]]),
      discard = FALSE
    )

## Arguments

fcd

  flow cytometry dataset.

data_slot

  data slot to use for the calculation, e.g. "orig" or "norm".

seed

  A seed is set for reproducibility.

prefix

  Optional prefix for the slot name of the output.

markers

  Vector of marker names to include or exclude from the calculation according to the discard parameter. See functions `used_markers` and `measured_markers` for the extraction of markers directly from the condor object.

discard

  LOGICAL if the markers specified should be included, "F", or excluded, "T", from the calculation. Default = F.

## Value

The function returns a fcd with a Principle Components (PC) data frame saved in `fcd$pca`. The name of the output consists of the prefix (if given) and the data slot.

## Details

runPCA

The calculation of the PC is based on the function `prcomp` from the R Stats Package. See the RDocumentation (https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/prcomp) for more details.