Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

topk

Make filter fun. the most abundant k taxa


Description

Make filter fun. the most abundant k taxa

Usage

topk(k, na.rm=TRUE)

Arguments

k

An integer, indicating how many of the most abundant taxa should be kept.

na.rm

A logical. Should NAs be removed. Default is TRUE.

Value

Returns a function (enclosure) that will return TRUE for each element in the most abundant k values.

See Also

Examples

## Use simulated abundance matrix
set.seed(711)
testOTU <- otu_table(matrix(sample(1:50, 25, replace=TRUE), 5, 5), taxa_are_rows=FALSE)
f1  <- filterfun_sample(topk(2))
wh1 <- genefilter_sample(testOTU, f1, A=2)
wh2 <- c(TRUE, TRUE, TRUE, FALSE, FALSE)
prune_taxa(wh1, testOTU)
prune_taxa(wh2, testOTU)

phyloseq

Handling and analysis of high-throughput microbiome census data

v1.34.0
AGPL-3
Authors
Paul J. McMurdie <joey711@gmail.com>, Susan Holmes <susan@stat.stanford.edu>, with contributions from Gregory Jordan and Scott Chamberlain
Initial release
2019-04-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.