context("counting taxa")
test_that("count_taxa is working", {
expect_equal(count_taxa(iris$Species), length(unique(iris$Species)))
expect_equal(count_taxa(Easplist), nrow(Easplist@taxonRelations))
expect_equal(
count_taxa(Easplist, level = "species"),
with(
Easplist@taxonRelations,
length(Level[paste(Level) == "species"])
)
)
expect_error(count_taxa(Easplist, level = "superspecies"))
Easplist <- tax2traits(Easplist, get_names = TRUE)
expect_is(
count_taxa(~ life_form + family, Easplist),
"data.frame"
)
expect_is(count_taxa(~ life_form + family, Easplist,
include_na = TRUE
), "data.frame")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.