Nothing
test_that("checks of format 'YYYY-MM-DD' for dates work", {
expect_equal(
check_date(date = "2000-01-01"),
as.Date("2000-01-01")
)
expect_error(
check_date(date = "2000-02-30"),
"Date is not in required format 'YYYY-MM-DD'."
)
expect_error(
check_date(date = "2000-13-01"),
"Date is not in required format 'YYYY-MM-DD'."
)
expect_error(
check_date(date = "01.01.2021"),
"Date is not in required format 'YYYY-MM-DD'."
)
})
test_that("finding closest year works", {
expect_equal(
find_closest_year(as.Date("2022-06-01")),
2022
)
expect_equal(
find_closest_year(as.Date("2022-06-30")),
2022
)
expect_equal(
find_closest_year(as.Date("2022-07-01")),
2023
)
expect_equal(
find_closest_year(as.Date("2022-12-31")),
2023
)
})
test_that("list to vector works", {
expect_equal(
list_to_vector(list(1, 2, NA, NULL)),
c(1, 2, NA, NA)
)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.