extract_fin_year: Extract the formatted financial year from a date

View source: R/extract_fin_year.R

extract_fin_yearR Documentation

Extract the formatted financial year from a date

Description

extract_fin_year takes a date and extracts the correct financial year in the PHS specified format from it.

Usage

extract_fin_year(date)

Arguments

date

A date which must be supplied with Date, POSIXct, POSIXlt or POSIXt class. base::as.Date(), lubridate::dmy() and as.POSIXct() are examples of functions which can be used to store dates as an appropriate class.

Details

The PHS accepted format for financial year is YYYY/YY e.g. 2017/18.

Value

A character vector of financial years in the form '2017/18'.

Examples

x <- lubridate::dmy(c(21012017, 04042017, 17112017))
extract_fin_year(x)

Health-SocialCare-Scotland/phsmethods documentation built on Jan. 28, 2024, 3:18 a.m.