tests/testthat/test_ecology.R

context("ecology")
test_that("we can call the ecology table", {
  needs_api()
  
  df <- ecology("Oreochromis niloticus")
  expect_is(df, "data.frame")
})

#' 
#' ## trophic levels and standard errors for a list of species

test_that("We can query trophic level fields only", {
  needs_api()
  
  df <- ecology(c("Oreochromis niloticus", "Salmo trutta"),
                fields=c("SpecCode", "FoodTroph", 
                         "FoodSeTroph", "DietTroph", "DietSeTroph"))
  expect_is(df, "data.frame")
  
})

Try the rfishbase package in your browser

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

rfishbase documentation built on June 7, 2023, 6:14 p.m.