powered by
Creates season, month, or quarter indicator from a time column. Useful for grouped analysis and preprocessing by season.
season_flag(data, date_col = NULL, type = c("season", "month", "quarter"), verbose = FALSE)
A character vector or factor containing the requested flag.
A data frame with a time column.
Time column index or name. If NULL, the first column matching date is used.
NULL
date
Type of flag: "season" (winter, spring, summer, autumn), "month" (abbreviated month), or "quarter" (Q1-Q4).
"season"
"month"
"quarter"
Logical; if TRUE, prints progress message.
TRUE
season_flag(data[1:200, c(1, 4, 17:19)], date_col = 1, type = "season")
Run the code above in your browser using DataLab