
Guess the Reporting Frequency of the Reference Dates
guess_date_frequency.RdEvaluates a vector of reference dates and returns a single string representing the data's reporting interval (e.g., "year", "month"). The function calculates the median day difference between consecutive dates.
Examples
# Monthly reporting dates
data <- data.frame(
ref_date = seq(as.Date("2020-01-01"), as.Date("2020-12-01"), by = "months")
)
guess_date_frequency(data)
#> [1] "month"
#> [1] "month"