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 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
19
20
pca_3d(
  micro_set,
  table,
  time_var,
  subject,
  y = clr,
  dist_method = "euclidean",
  type = "PCoA",
  plot_scores = FALSE,
  pch = 16,
  cex.axis = 1,
  cex.lab = 1,
  cex = 1,
  main = NULL,
  subtitle = NULL,
  scalewt = TRUE,
  print.legend = TRUE,
  legend.title = "Time Points",
  legend.position = "right"
)

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

y

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

dist_method

Dissimilartiy method to be calculated by vegdist. Euclidean by default

type

"PCA" for principle components or "PCoA" to calculated dissimilarity matrix using vegdist

plot_scores

Plot the scores instead of the principle components

pch

Plotting "character", i.e. symbol to use.

cex.axis

Options for scatterplot3d

cex.lab

Options for scatterplot3d

cex

Options for scatterplot3d

main

Plot title

subtitle

Plot subtitle

scalewt

Logical; center and scale OTU table, recommended

print.legend

Logical; print plot legend

legend.title

Title for plot legend. Ignored if print.legend = FALSE

legend.position

'x' argument in legend

Details

Requires that you have separate columns for subject ID and time point. Data must be complete across time points. The function will automatically filter out incomplete cases with a warning message.

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

Author(s)

Charlie Carpenter, Kayla Williamson

References

vegdist

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 %>% pca_3d(table = "Family", time_var = day, subject = study_id, legend.title = "Day")

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