quarterIndex: Generate an index of quarters

Description Usage Arguments Examples

View source: R/timeIndices.R

Description

A function to create a quarter index variable

Usage

1

Arguments

x

A vector or column of dates

Examples

1
2
3
4
5
6
# given a vector of dates
df <- data.frame(date = as.Date(c("2017-01-01","2017-04-01","2017-07-01","2017-08-01"),
format = "%Y-%m-%d"))
# calculate the time period variable
df$period <- quarterIndex(df$date)
df

IndexNumR documentation built on Feb. 7, 2022, 5:09 p.m.