tests/testthat/test_trends.R

context("Loading trends data")

skip_on_cran()

test_that("load_trends()", {
  trends <- load_trends("yebsap-example")
  expect_is(trends, "data.frame")
  cols <- c("species_code", "season", "start_year", "end_year", "start_date",
            "end_date", "srd_id", "longitude", "latitude", "abd", "abd_ppy",
            "abd_ppy_lower", "abd_ppy_upper", "abd_ppy_nonzero", "abd_trend",
            "abd_trend_lower", "abd_trend_upper")
  expect_equal(names(trends), cols)
  expect_gt(nrow(trends), 0)

  trends_folds <- load_trends("yebsap-example", fold_estimates = TRUE)
  cols <- c("species_code", "season", "fold", "srd_id", "latitude", "longitude",
            "abd", "abd_ppy")
  expect_equal(names(trends_folds), cols)
  expect_equal(nrow(trends_folds), 100 * nrow(trends))
})

Try the ebirdst package in your browser

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

ebirdst documentation built on Nov. 16, 2023, 5:07 p.m.