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
three_mode(
  micro_set,
  table,
  group,
  time_var,
  subject,
  y = clr,
  plot_scores = F,
  main = NULL,
  subtitle = NULL,
  legend_title = 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

y

Value to calculate principle components or coordinates on. Default is centered log ratio (recommended)

plot_scores

Plot the scores instead of the principle components

main

Plot title

subtitle

Plot subtitle

legend_title

Plot legend title

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
7
data(bpd_phy); data(bpd_cla); data(bpd_ord); data(bpd_fam); data(bpd_clin)
otu_tabs = list(Phylum = bpd_phy, Class = bpd_cla,
Order = bpd_ord, Family = bpd_fam)

set <- tidy_micro(otu_tabs = otu_tabs, clinical = bpd_clin)

set %>% three_mode(table = "Family", group = bpd1, time_var = day, subject = study_id)

CharlieCarpenter/tidyMicro documentation built on April 25, 2021, 4:09 p.m.