tests/testthat/test-flags.R

test_that("flag warning", {
  d <- CA003076680
  d[["tmax_flag"]][1] <- "I"
  expect_warning(monthly(d))
  expect_warning(annual(d))
  expect_warning(coverage(d))
})

test_that("remove flagged", {
  d <- CA003076680
  flags <- sample(1:nrow(d), sample(100 : (nrow(d) / 2), 1))
  d[["tmax_flag"]][flags] <- "I"
  d <- remove_flagged(d)
  expect_equal(nrow(CA003076680) - length(flags), nrow(d))
})

Try the GHCNr package in your browser

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

GHCNr documentation built on April 3, 2025, 11:16 p.m.