Learn R Programming

dataprep (version 0.1.8)

season_flag: Season flag

Description

Creates season, month, or quarter indicator from a time column. Useful for grouped analysis and preprocessing by season.

Usage

season_flag(data, date_col = NULL, type = c("season", "month", "quarter"),
            verbose = FALSE)

Value

A character vector or factor containing the requested flag.

Arguments

data

A data frame with a time column.

date_col

Time column index or name. If NULL, the first column matching date is used.

type

Type of flag: "season" (winter, spring, summer, autumn), "month" (abbreviated month), or "quarter" (Q1-Q4).

verbose

Logical; if TRUE, prints progress message.

Examples

Run this code
season_flag(data[1:200, c(1, 4, 17:19)], date_col = 1, type = "season")

Run the code above in your browser using DataLab