pca_3d: Create 3d PCA plots

Description Usage Arguments Details Author(s) References Examples

View source: R/pca_3d.R

Description

Create three dimensional PCA plots from longitudinal microbiome data or multiple omics data sets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
pca_3d(
  micro_set,
  table,
  time_var,
  subject,
  modes = "AC",
  dist_method = "euclidean",
  type = "PCoA",
  plot_scores = F,
  n_compA,
  n_compB,
  n_compC,
  cex.axis = 1,
  cex.lab = 1,
  main = NULL,
  subtitle = NULL,
  scalewt = TRUE
)

Arguments

micro_set

A tidy_micro data set

table

OTU table of interest

time_var

The time point variable column name in your tidi_MIBI set

subject

The subject variable column name in your tidi_MIBI set

modes

Components of the data to focus on: time, subjects, bacteria, etc.

dist_method

Dissimilartiy method to be calculated by vegdist. Euclidean by default

type

Either "PCA" or "PCoA"

plot_scores

Plot the scores instead of the principle components

n_compA

The number of components along first axis. See details

n_compB

The number of components along second axis. See details

n_compC

The number of components along third axis. See details

cex.axis

Options for scatterplot3d

cex.lab

Options for scatterplot3d

main

Plot title

subtitle

Plot subtitle

scalewt

Logical; center and scale OTU table, recommended

Details

Requires that you have columns for subject name and time point. Data must be complete across time points. The function will filter out inconsistent subjects

When type = "PCoA" the component matrices must be specified prior to the optimization. This is handled automatically.

If n_compA, n_compB, and n_compC aren't specified they will default to the number of complete subjects, the number of taxa, and the number of time points, respectively. This slows down performance slightly, but will not change the results.

Author(s)

Charlie Carpenter, Kayla Williamson

References

help(vegdist)

Examples

1
2
3
4
5
6
data(phy); data(cla); data(ord); data(fam); data(met)

otu_tabs = list(Phylum = phy, Class = cla, Order = ord, Family = fam)
set <- tidy_micro(otu_tabs = otu_tabs, meta = met)

set %>% pca_3d(table = "Family", time_var = day, subject = study_id)

CharlieCarpenter/tidy.micro documentation built on Jan. 19, 2020, 6:28 p.m.