add_date_cols: Add date information

View source: R/date_time.R

add_date_colsR Documentation

Add date information

Description

Add columns to a data frame with information extracted from the indicated date column

Usage

add_date_cols(df, dt_col, cols)

Arguments

df

data frame that has the date column

dt_col

name of the column with the dates of interest

cols

columns to add, currently "year","yr","month","week","day", "weekday","month_name","month_abb","weekday_name","weekday_abb"

Value

same data frame with added columns

Examples


df<-data.frame(date=sample(seq(as.Date('2010/01/01'), as.Date('2019/12/31'), by="day"), 30))
add_date_cols(df,"date")


JahNorr/orrr documentation built on Jan. 29, 2025, 5:11 p.m.