R/transform-filter.R
filter_taxa.Rd
Variations of phyloseq::filter_taxa()
that allows a purrr-style anonymous
function.
filter_taxa(physeq, fun, prune = FALSE) filter_taxa2(physeq, fun)
physeq | |
---|---|
fun | A function or formula that can be converted to a function by
|
prune | A logical. If |
filter_taxa()
simply calls purrr::as_mapper()
on fun
and passes the
resulting function on to phyloseq::filter_taxa()
. filter_taxa2()
also
sets prune = TRUE
, which is convenient when passing a phyloseq object in a
pipe chain (see example).
filter_taxa2
: Sets prune = TRUE
data(GlobalPatterns) # Filter low prevalence taxa and then convert to proportions gp.prop <- GlobalPatterns %>% filter_taxa2(~ sum(. > 0) > 5) %>% transform_sample_counts(~ . / sum(.))#> Error in fun(1:10): could not find function "fun"