plotPCA {rexposome} | R Documentation

## Ploting PCA

### Description

Methdo to draw a plot for PCA contained in an ExposomePCA

### Usage

    plotPCA(
      object,
      set,
      cmpX = 1,
      cmpY = 2,
      show.exposures = FALSE,
      show.samples = FALSE,
      phenotype
    )

### Arguments

`object` | An onbject of class ExposomePCA
`set` | Group (`"all"`, `"samples"` or `"exposures"`) taht will be ploted.
`cmpX` | (default: `1`) component to be placed at X axis
`cmpY` | (default: `2`) component to be placed at Y axis
`show.exposures` | (default: `FALSE`) If set to true, labels indicating the exposures are shown.
`show.samples` | (default: `FALSE`) If set to true, labels indicating the samples are shown.
`phenotype` | If `set` is set to `"samples"` can be used to color samples by phenotype

### Value

An object of class `ggplot` or an object of class `gtable` if argument `set` was set to `"all"`.

### See Also

pca to compite PCA on an ExposomeSet, plotPCA to plot the PCA, ExposomePCA as main class

### Examples

    data("exposome")
    epca <- pca(expo[3:7, 1:100])
    # A grid with exposures space, samples space and explained variance
    plotPCA(epca, set = "all")
    # Only exposures space
    plotPCA(epca, set = "exposures") + ggplot2::theme(legend.position = "bottom")
    # Only samples space
    plotPCA(epca, set = "samples")
    # Only samples space but coloured by phenotype
    plotPCA(epca, set = "samples", phenotype = "sex") +
    ggplot2::theme(legend.position = "bottom")

[Package rexposome version 1.16.0 Index]