View source: R/phy_substitute_metadata.R
phy_substitute_metadata | R Documentation |
Substitute metadata in phyloseq objects. the two data frames must have row names matching sample names. The sample order doesn't matter, because the functions will reorder the new metatadata rows, to match the sample order in the phyloseq object.
phy_substitute_metadata(physeq, new_metadata)
physeq |
A phyloseq object contaning or not containing 'sample_data' |
new_metadata |
a data.frame object, with rownames containing 'sample_names' of the 'physeq' object |
a phyloseq object with the new metadata stored under the "sam_data" slot
data("GlobalPatterns") exMeta <- microbiome::meta(GlobalPatterns) newMeta <- exMeta %>% mutate(newVar = runif(n = nrow(exMeta), min = 0, max = 20)) GlobalPatterns <- phy_substitute_metadata(physeq = GlobalPatterns, new_metadata = newMeta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.