library(rbiom)
# Duplicate the HMP50 example dataset.
biom <- hmp50$clone()
# Display an overall summary of the rbiom object.
biom
# Markdown syntax for comments is recommended.
biom$comment %>% cli::cli_text()
# Demonstrate a few accessors.
biom$n_samples
biom$fields
biom$metadata
# Edit the metadata table.
biom$metadata$rand <- sample(1:50)
biom %<>% mutate(Obese = BMI >= 30, Sex = NULL)
biom %<>% rename('Years Old' = "Age")
biom$metadata
# Subset the rbiom object
biom %<>% subset(`Body Site` == "Saliva" & !Obese)
biom$metadata
# Rarefy to an even sampling depth
sample_sums(biom)
biom %<>% rarefy()
sample_sums(biom)
Run the code above in your browser using DataLab