make_date_cols: Function to add "year_of" and "month_of" columns to a...

View source: R/date-helpers.R

make_date_colsR Documentation

Function to add "year_of" and "month_of" columns to a dataframe

Description

Function to add "year_of" and "month_of" columns to a dataframe

Usage

make_date_cols(df, date_col)

Arguments

df

A data frame with a date column

date_col

The unquoted name of the date column

Value

A data frame with the new date columns.

Examples

df <- data_frame(date_of = seq.Date(as.Date("2000-01-01"),
                                    as.Date("2000-12-01"),
                                    by = "1 month"),
                 x = runif(12))
make_date_cols(df, date_of)

amboseli/ramboseli documentation built on July 3, 2025, 11:45 p.m.