if (FALSE) {
# Parse data for example
x = parse_tax_data(hmp_otus, class_cols = "lineage", class_sep = ";",
class_key = c(tax_rank = "taxon_rank", tax_name = "taxon_name"),
class_regex = "^(.+)__(.+)$")
# Count samples with at least one read
calc_n_samples(x, data = "tax_data")
# Count samples with at least 5 reads
calc_n_samples(x, data = "tax_data", more_than = 5)
# Return a vector instead of a table
calc_n_samples(x, data = "tax_data", drop = TRUE)
# Only use some columns
calc_n_samples(x, data = "tax_data", cols = hmp_samples$sample_id[1:5])
# Return a count for each treatment
calc_n_samples(x, data = "tax_data", groups = hmp_samples$body_site)
# Rename output columns
calc_n_samples(x, data = "tax_data", groups = hmp_samples$body_site,
out_names = c("A", "B", "C", "D", "E"))
# Preserve other columns from input
calc_n_samples(x, data = "tax_data", other_cols = TRUE)
calc_n_samples(x, data = "tax_data", other_cols = 2)
calc_n_samples(x, data = "tax_data", other_cols = "otu_id")
}
Run the code above in your browser using DataLab