| Title: | Continuous Epidemiological Week Indexing for Time-Series Analysis |
| Version: | 0.1.1 |
| Description: | Provides a simple algorithm to generate a continuous epidemiological week index from date variables in a dataframe. Weeks are computed as sequential 7-day intervals starting from the earliest observed date. They do not reset at calendar year boundaries and are not ISO 8601 nor MMWR calendar weeks. The approach is intended for epidemiological modeling and time-series analysis where temporal continuity is required. The generated weeks are sequential and do not reset at calendar year boundaries. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Imports: | lubridate |
| RoxygenNote: | 7.3.3 |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-02-11 08:56:18 UTC; Daniel_Degina_MY |
| Author: | Daniel Degina [aut, cre, cph] |
| Maintainer: | Daniel Degina <deginadan@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-02-13 16:20:23 UTC |
Generate Continuous Epidemiological Week Index for a Date Column
Description
This function adds a continuous epidemiological week index to a data frame by assigning each date to a sequential week number starting from a reference date.
Usage
cepiweek(data, col_date, start = NULL)
Arguments
data |
A data frame containing the date column. |
col_date |
Name of the date column (string). |
start |
Optional start date for counting weeks (Date or string).
Defaults to the minimum date in the column |
Details
The generated weeks do not reset at calendar year boundaries and are not ISO 8601 or MMWR weeks. You can specify the start date for week counting; if none is provided, the minimum date in the column is used.
This design is intended for epidemiological modeling, time-series analysis, and nowcasting applications.
Value
A data frame with an added cepiweek column containing
continuous week indices.
Examples
k <- data.frame(
num = c(1, 2, 3),
date = c("2024-01-15", "2025-02-12", "2026-08-01")
)
cepiweek(k, col_date = "date")