View source: R/amp_export_long.R
amp_export_long | R Documentation |
Transforms any ampvis2 object into a long data frame (data.table
) to facilitate custom data analysis. Only the elements OTU counts (data$abund
), taxonomy (data$tax
), and metadata (data$metadata
) are used, not phylogenetic tree or DNA sequences.
amp_export_long(
data,
metadata_vars = colnames(data$metadata),
tax_levels = colnames(data$tax)
)
data |
(required) Data list as loaded with |
metadata_vars |
A character vector of sample metadata variables to include from |
tax_levels |
A character vector of taxonomic levels to include from |
A data.table
in long format.
Kasper Skytte Andersen ksa@bio.aau.dk
Thomas Yssing Michaelsen tym@bio.aau.dk
# load minimal example data
d <- amp_load(example_otutable, example_metadata)
# transform d into a long-format data frame
d_long <- amp_export_long(d, metadata_vars = "Date", tax_levels = c("OTU", "Genus"))
# print the data frame (data.table)
d_long
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.