
Create three dimensional PCA plots from longitudinal data or multiple omics data sets.
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"
)
A tidy_micro data set
OTU table of interest
The time point variable column name in your tidi_MIBI set
The subject variable column name in your tidi_MIBI set
Value to calculate principle components or coordinates on. Default is centered log ratio (recommended)
Dissimilartiy method to be calculated by vegdist
. Euclidean by default
"PCA" for principle components or "PCoA" to calculated dissimilarity matrix using vegdist
Plot the scores instead of the principle components
Plotting "character", i.e. symbol to use.
Options for scatterplot3d
Options for scatterplot3d
Options for scatterplot3d
Plot title
Plot subtitle
Logical; center and scale OTU table, recommended
Logical; print plot legend
Title for plot legend. Ignored if print.legend = FALSE
'x' argument in legend
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.
# NOT RUN {
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")
# }
Run the code above in your browser using DataLab