cor_rocky_mtn: Create Rocky Mountain plots from taxa relative abundance...

Description Usage Arguments Value Author(s) Examples

View source: R/cor_rocky_mtn.R

Description

Calculate the correlation between the relative abundance of each taxa within a specified table and a continuous variable of interest. Correlation is calculated by cor. By default, Kendall's correlation is used to account for the prevalence of ties that often occur (lots of 0s)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
cor_rocky_mtn(
  micro_set,
  table,
  x,
  y = clr,
  method = c("pearson", "kendall", "spearman"),
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  subtitle = NULL,
  cut_lines = TRUE,
  line_text = TRUE,
  sig_text = TRUE,
  lwd = 1,
  cor_label = 0.5,
  breaks = c(-0.6, -0.5, -0.3, 0.3, 0.5, 0.6)
)

Arguments

micro_set

A tidy_micro data set

table

OTU table of interest

x

Continuous variable of interest

y

The taxa information. The centered log ratio (clr) is recommended.

method

Correlation type; must be supported by cor. By default it is "spearman" to use with clr. If you'd like to use taxa ra, it is recommend you switch to Kendall's correlation to account for the large number of ties common in taxa ra (lots of 0s)

main

Plot title

xlab

Lable for x-axis

ylab

Label for y-axis

subtitle

Plot subtitle

cut_lines

Add lines for p-value cutoffs

line_text

Label p-value cut-offs

sig_text

Label taxa with correlations greater than cor_label in magnitude

lwd

line width for cut_lines

cor_label

Cutoff for correlations to be labeled

breaks

Where to place cut_lines along y-axis

Value

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

Author(s)

Charlie Carpenter, Dan Frank

Examples

1
2
3
4
5
6
7
8
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) %>%
filter(day == 7) ## Only including the first week

set %>% cor_rocky_mtn(table = "Family", weight, cor_label = 0.3)

tidyMicro documentation built on Jan. 13, 2021, 6:18 a.m.