Learn R Programming

aedseo (version 0.1.2)

epi_calendar: Determine Epidemiological Season

Description

[Stable]

This function identifies the epidemiological season 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 = 40, end = 20)

Value

A character vector indicating the season:

  • "out_of_season" if the date is outside the specified season,

  • If within the season, the function returns a character string indicating the epidemiological season.

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.

Examples

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

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

epi_calendar(as.Date("2023-01-15"), start = 40, end = 20)
# Expected output: "2022/2023"

epi_calendar(as.Date("2023-12-01"), start = 40, end = 20)
# Expected output: "2023/2024"

Run the code above in your browser using DataLab