epi_calendar {aedseo}R Documentation

Determine Epidemiological Season

Description

This function identifies the epidemiological season, (must span new year) to which a given date belongs. The epidemiological season is defined by a start and end week, where weeks are numbered according to the ISO week date system.

Usage

epi_calendar(date, start = 21, end = 20)

Arguments

date

A date object representing the date to check.

start

An integer specifying the start week of the epidemiological season.

end

An integer specifying the end week of the epidemiological season.

Value

A character vector indicating the season:

Examples

# Check if a date is within the epidemiological season
epi_calendar(as.Date("2023-09-15"), start = 21, end = 20)
# Expected output: "2023/2024"

epi_calendar(as.Date("2023-05-30"), start = 40, end = 20)
# Expected output: "out_of_season"

try(epi_calendar(as.Date("2023-01-15"), start = 1, end = 40))
# Expected error: "`start` must be greater than `end`!"

epi_calendar(as.Date("2023-10-06"), start = 40, end = 11)
# Expected output: "2023/2024"

[Package aedseo version 0.3.0 Index]