cor_heatmap: Create correlation heatmaps of taxa and another continuous...

Description Usage Arguments Details Value Examples

View source: R/cor_heatmap.R

Description

Calculated the correlation between a specified continuous variable and some taxa measure. Correlation type and taxa measure (count, relative abundance, etc.) can be specified by the user but is "spearman" and relative abundance, respectively, by default

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
cor_heatmap(
  micro_set,
  table,
  ...,
  y = clr,
  method = c("pearson", "kendall", "spearman"),
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  subtitle = NULL,
  legend_title = NULL,
  low_grad,
  high_grad
)

Arguments

micro_set

A tidy_micro data set

table

The OTU table

...

Continuous variables of interest

y

The taxa information: cts, ra, etc. 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

x-axis label

ylab

y-axis label

subtitle

Plot label

legend_title

Title for the legend

low_grad

Colors for the corelation magnitude. Will be fed into scale_fill_gradient

high_grad

Colors for the corelation magnitude. Will be fed into scale_fill_gradient

Details

The output will give gray columns if there are missing values in the supplied continuous variable

Value

Returns a ggplot that you can add geoms to if you'd like

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_heatmap(table = "Class", gestational_age, weight)

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