ToFiscalDate: Calendar To Fiscal Date Parsing

Description Usage Arguments Examples

View source: R/format-date.R

Description

This function takes a vector of dates and returns either the fiscal year, month, or week, or months, weeks, or days since the start of the fiscal year.

Usage

1
ToFiscalDate(date, start.month = 7, output = "year")

Arguments

date

Dates to be parsed

start.month

Starting month number of the fiscal year; defaults to 7 (July)

output

Output format, including year for fiscal year number or days for days passed since the beginning of the fiscal year

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(dts <- ToDate(paste("2012", 1:12, 1, sep="-")))

ToFiscalDate(dts)
# Return fiscal year by default

ToFiscalDate(dts, start.month=9, output="month")
# Return fiscal month number

ToFiscalDate(dts, start.month=1, output="week")
ToFiscalDate(dts, start.month=1, output="weeks")
# 'week' returns week number while 'weeks' returns weeks elapsed

phively/wranglR documentation built on April 11, 2020, 5:12 a.m.