View source: R/adders_samples.R
add_sample_tibble | R Documentation |
add_sample_tibble
adds a sample tibble to the tidyamplicons object.
add_sample_tibble(ta, sample_tibble)
ta |
Tidyamplicons object. |
sample_tibble |
A tibble containing sample data for each sample. samples should be rows, while sample data should be columns. At least one column name needs to be shared with the sample tibble of ta. The default shared column name is 'sample'. |
This function adds a sample tibble containing metadata for each sample to the
tidyamplicons object. It is used after initiating a tidyamplicons object
using a numerical abundance matrix and the function
create_tidyamplicons
. Also see add_taxon_tibble
to update the taxon data of the tidyamplicons object.
# Initiate abundance matrix
x <- matrix(
c(1500, 1300, 280, 356),
ncol = 2
)
rownames(x) <- c("taxon1", "taxon2")
colnames(x) <- c("sample1", "sample2")
# Convert to tidyamplicons object
data <- create_tidyamplicons(x,
taxa_are_columns = FALSE
)
# Initiate sample tibble
sample <- c("sample1", "sample2")
environment <- c("food fermentation", "human stool")
sample_tibble <- tibble::tibble(sample, environment)
# Add sample tibble to tidyamplicons object
data <- data %>%
add_sample_tibble(sample_tibble)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.