Learn R Programming

rbiom

rbiom is designed for microbiome researchers, providing visualizations and statistical analyses from Biological Observation Matrix (BIOM) files.

Installation

The latest stable version can be installed from CRAN.

install.packages('rbiom')

The development version is available on GitHub.

install.packages('pak')
pak::pak('cmmr/rbiom')

Usage

Import and rarefy abundance counts.

library(rbiom)

infile <- system.file(package = 'rbiom', 'extdata', 'hmp50.bz2')
biom   <- rarefy(infile)

Explore associations with metadata.

bdiv_ord_plot(biom, stat.by = 'Body Site', facet.by = 'Sex')

adiv_boxplot(biom, x = 'Sex', adiv = c('otu', 'shan'), stat.by = 'Body Site')

subset(biom, `Body Site` == 'Buccal mucosa') %>% 
  taxa_corrplot('Age', taxa = 2, layers = 'ptc', fit = 'lm', test = 'emtrends')

Summarize counts by taxonomic rank.

taxa_heatmap(biom, taxa = 10, tracks = c('body', 'age'))

taxa_stacked(biom, rank = 'Phylum')

taxa_table(biom, 'Phylum')
#> # A tibble: 294 × 8
#>    .rank  .sample .taxa          .abundance   Age   BMI `Body Site`   Sex   
#>    <fct>  <chr>   <fct>               <dbl> <dbl> <dbl> <fct>         <fct> 
#>  1 Phylum HMP01   Firmicutes            866    22    20 Buccal mucosa Female
#>  2 Phylum HMP01   Bacteroidetes         202    22    20 Buccal mucosa Female
#>  3 Phylum HMP01   Actinobacteria         14    22    20 Buccal mucosa Female
#>  4 Phylum HMP01   Proteobacteria         60    22    20 Buccal mucosa Female
#>  5 Phylum HMP01   Fusobacteria           33    22    20 Buccal mucosa Female
#>  6 Phylum HMP01   Tenericutes             0    22    20 Buccal mucosa Female
#>  7 Phylum HMP02   Firmicutes            814    24    23 Buccal mucosa Male  
#>  8 Phylum HMP02   Bacteroidetes         181    24    23 Buccal mucosa Male  
#>  9 Phylum HMP02   Actinobacteria         49    24    23 Buccal mucosa Male  
#> 10 Phylum HMP02   Proteobacteria         97    24    23 Buccal mucosa Male  
#> # ℹ 284 more rows

Documentation

The online manual for rbiom is available at https://cmmr.github.io/rbiom/. It includes a getting started guide, articles that explore specific use cases, and reference pages for each function.

Community guidelines

Support

Bug reports, feature requests, and general questions can be submitted at https://github.com/cmmr/rbiom/issues.

Contributing

Pull requests are welcome. Please ensure contributed code is covered by tests and documentation (add additional tests and documentation as needed) and that it passes all automated tests.

Automated tests

The following commands will check if rbiom passes the bundled testing suite.

install.packages('testthat')
testthat::test_check('rbiom')

Copy Link

Version

Install

install.packages('rbiom')

Monthly Downloads

2,015

Version

3.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Daniel P. Smith

Last Published

May 8th, 2026

Functions in rbiom (3.1.0)

adiv_table

Calculate the alpha diversity of each sample.
adiv_stats

Test alpha diversity for associations with metadata.
bdiv_boxplot

Visualize BIOM data with boxplots.
bdiv_clusters

Cluster samples by beta diversity k-means.
biom_relativize

Relativize Counts to Proportions
bdiv_heatmap

Display beta diversities in an all vs all grid.
bdiv_stats

Test beta diversity for associations with metadata.
biom_inflate

Inflate Relative Abundances to Integer Counts
bdply

Apply a function to each subset of an rbiom object.
bdiv_ord_plot

Ordinate samples and taxa on a 2D plane based on beta diversity distances.
bdiv_table

Distance / dissimilarity between samples.
biom_merge

Combine several rbiom objects into one.
bdiv_ord_table

Calculate PCoA and other ordinations, including taxa biplots and statistics.
bdiv_corrplot

Visualize beta diversity with scatterplots and trendlines.
documentation_biom.rbiom

documentation_biom.rbiom
convert_to

Convert biom data to an external package class
distmat_ord_table

Run ordinations on a distance matrix.
distmat_stats

Run statistics on a distance matrix vs a categorical or numeric variable.
biom_rescale

Rescale Counts to a Specific Range
documentation_dist_test

documentation_dist_test
documentation_heatmap

documentation_heatmap
documentation_clusters

documentation_clusters
documentation_cmp

documentation_cmp
documentation_default

documentation_default
export

Export data to QIIME 2 or mothur.
gems

Global Enteric Multicenter Study (n = 1,006)
documentation_return.biom

documentation_return.biom
hmp50

Human Microbiome Project - demo dataset (n = 50)
documentation_plot_return

documentation_plot_return
documentation_taxa.4

documentation_taxa.4
matrix_ops

Deprecated matrix transformations
glimpse.rbiom

Get a glimpse of your metadata.
documentation_rank.2

documentation_rank.2
documentation_rank.NULL

documentation_rank.NULL
rare_multiplot

Combines rare_corrplot and rare_stacked into a single figure.
pull.rbiom

Map sample names to metadata field values.
rare_corrplot

Visualize rarefaction curves with scatterplots and trendlines.
rbiom_objects

Working with rbiom Objects.
rarefy

Rarefy Counts to a Constant Depth
plot_heatmap

Create a heatmap with tracks and dendrograms from any matrix.
rare_stacked

Visualize the number of observations per sample.
read_biom

Parse counts, metadata, taxonomy, and phylogeny from a BIOM file.
modify_metadata

Create, modify, and delete metadata fields.
rbiom-package

rbiom: Read/Write, Transform, and Summarize BIOM Data
slice_metadata

Subset to a specific number of samples.
read_fasta

Parse a fasta file into a named character vector.
speed

Speed Ups.
read_tree

Read a newick formatted phylogenetic tree.
sample_sums

Summarize the taxa observations in each sample.
stats_corrplot

Visualize regression with scatterplots and trendlines.
subset

Subset an rbiom object by sample names, OTU names, metadata, or taxonomy.
stats_boxplot

Visualize categorical metadata effects on numeric values.
stats_table

Run non-parametric statistics on a data.frame.
reexports

Objects exported from other packages
taxa_boxplot

Visualize BIOM data with boxplots.
suggest_rarefy_depth

Suggest Rarefaction Depth
taxa_corrplot

Visualize taxa abundance with scatterplots and trendlines.
taxa_clusters

Cluster samples by taxa abundances k-means.
taxa_map

Map OTUs names to taxa names at a given rank.
taxa_stats

Test taxa abundances for associations with metadata.
taxa_table

Taxa abundances per sample.
taxa_heatmap

Display taxa abundances as a heatmap.
taxa_stacked

Display taxa abundances as a stacked bar graph.
suggest_inflate_depths

Suggest Inflation Depths
taxa_sums

Get summary taxa abundances.
tree_subset

Create a subtree by specifying tips to keep.
with

Evaluate expressions on metadata.
write_biom

Save an rbiom object to a file.
as_rbiom

Convert a variety of data types to an rbiom object.
babies

Longitudinal Stool Samples from Infants (n = 2,684)
adiv_boxplot

Visualize alpha diversity with boxplots.
adiv_corrplot

Visualize alpha diversity with scatterplots and trendlines.
as.matrix.rbiom

Convert an rbiom object to a simple count matrix.
as.list.rbiom

Convert an rbiom object to a base R list.