tests/testthat/test-rankagg.R

context("rankagg")

test_that("rankagg throws error", {
  skip_on_cran()
  skip_if_not_installed("vegan")

  data(dune.taxon, package = 'vegan')
  dat <- dune.taxon
  set.seed(1234)
  dat$abundance <- round(rlnorm(n = nrow(dat), meanlog = 5, sdlog = 2), 0)
  out <- rankagg(data = dat, datacol = "abundance", rank = "Genus")

  expect_error(rankagg(datacol = "abundance", rank = "Genus"))
  expect_error(rankagg(data = dat, datacol = "abundance"))

  expect_is(out, "data.frame")
  expect_equal(out[1, 2], 13)
})

Try the taxize package in your browser

Any scripts or data that you put into this service are public.

taxize documentation built on Sept. 11, 2024, 6:13 p.m.