three_mode: Create Three Mode PCA and PCoA plots

Description Usage Arguments Details Value Author(s) Examples

View source: R/three_mode_pca.R

Description

Three Mode Principal Components, an ordination method that can take into account repeated measure of subjects. These methods have also been extended to other common ecological distance metrics for Three Mode Principal Coordinate Analysis

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
three_mode(
  micro_set,
  table,
  group,
  time_var,
  subject,
  modes = "AC",
  plot_scores = F,
  n_compA,
  n_compB,
  n_compC,
  main = NULL,
  subtitle = NULL,
  scalewt = TRUE
)

Arguments

micro_set

A tidy_micro data set

table

OTU table of interest

group

A categorical variable to color by

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.

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

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

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.

Value

A ggplot you can add geoms to if you'd like

Author(s)

Charlie Carpenter, Kayla Williamson

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 %>% three_mode(table = "Family", group = bpd, time_var = day, subject = study_id)

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