days_in_fq: Get the number of days in the quarter of a financial year

View source: R/days_in_fq.R

days_in_fqR Documentation

Get the number of days in the quarter of a financial year

Description

For working with KH03, quarters are in format "yyyyq". Want number of days per quarter and this varies by leap year. This method takes leap year into account.

Usage

days_in_fq(x)

Arguments

x

A financial year quarter in format "yyyyq"

Details

Note: This function must be used in conjunction with rowwise from dplyr or sapply.

Value

The number of days in the quarter, accounting for leap years.

Examples

days_in_fq("20131")
days_in_fq("20134")
# 2016 is a leap year, should have 91 days in quarter 1 (i.e. 20154)
days_in_fq("20154")
x <- data.frame(fyear = c(20151, 20152, 20153, 20154))
x$days <- days_in_fq(x$fyear)

PublicHealthEngland/hcaidcs documentation built on Jan. 19, 2024, 8:38 a.m.