tests/testthat/test-14-day_of_year.R

context("Day of the year")
test_that("day_of_year function works as expected", {
  # First day of the year
  dayofyear = day_of_year("2017-01-01", format= "%Y-%m-%d")
  expect_equal(dayofyear, 1)
  # Summer Equinox
  dayofyear =  day_of_year("2017-06-20", format= "%Y-%m-%d")
  expect_equal(dayofyear, 171)
  # Last day of the year
  dayofyear = day_of_year("2017-12-31", format= "%Y-%m-%d")
  expect_equal(dayofyear, 365)
})

Try the TrenchR package in your browser

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

TrenchR documentation built on Sept. 14, 2023, 1:07 a.m.