View source: R/taxatree_label.R
taxatree_label | R Documentation |
taxatree_label
is used internally by taxatree_plotkey
, but
can also be used prior to taxatree_plots
to label those plots directly
...
arguments are passed to dplyr::filter()
,
so all filter
syntax can be used.
taxatree_label(
data,
...,
.label_var = "label",
.node_fun = list(prevalence = prev)
)
data |
psExtra (or phyloseq) |
... |
REQUIRED logical conditions for labelling e.g. rank == "Phylum", p.value < 0.1 | taxon %in% listOfTaxa |
.label_var |
name of label indicator variable to be created. If you change this, beware that taxatree_plotkey will not work, you will need to called taxatree_plot_label with |
.node_fun |
named list of length 1 providing |
If taxatree_stats missing (or if data is a phyloseq) it will create a plain taxatree_stats dataframe using only taxatree_nodes
node_fun
can also be a precalculated dataframe (output of taxatree_nodes)
but you should probably not use this option.
This is used internally for efficiency inside taxatree_plotkey()
psExtra with (modified) taxatree_stats dataframe
# simple example with plain phyloseq input
data("dietswap", package = "microbiome")
labelled <- dietswap %>%
tax_prepend_ranks() %>%
taxatree_label(rank == "Phylum", prevalence > 0.1)
# Note that "prevalence" column was available in data
# because it is created by `taxatree_nodes()` using the named function
# provided to the `node_fun` argument
# psExtra is returned
labelled
# notice how both conditions must be met for label column to be TRUE
labelled %>% taxatree_stats_get()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.