library(testthat)
library(phyloseq)
library(rlang)
library(micrec)
library(tibble)
context("Testing importing io for recipe type objects")
data(GlobalPatterns, package = "phyloseq") # data set with phylogenetic tree
data(enterotype, package = "phyloseq")
test_that("extract_vars extracts the right data", {
mix <- c(taxa_names(enterotype)[2:10], "Nationality","Gender", "Age")
none <- paste0("Tax",1:10)
df <- extract_vars(enterotype, mix)
df2 <- extract_vars(enterotype, none)
not_phyloseq <- matrix(rnorm(1000), nrow = 10, ncol = 10)
expect_true(is_tibble(df))
expect_equal(ncol(df), length(mix))
expect_equal(nrow(df), nsamples(enterotype))
expect_error(extract_vars(not_phyloseq, mix))
expect_identical(df2, tibble(samp_id = sample_names(enterotype)))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.