FY() is a deprecated function. It returns the current financial year. It also returns financial year based on parameter dates, or financial year based on a parameter dates and offset_period in years.

FY(date = Sys.Date(), offset_period = 0,
  optFYstart = getOption("busdaterFYstart", default = "07-01"))

Arguments

date

A date vector for which financial year is required. Date must be POSIXct or POSIXlt or Date objects.

offset_period

A positive or negative number coercible to integer to shift the year by, e.g. in the case of FY, -1 for previous year, 1 for next year. More generally in page_boundaries function it is a number of periods of a specified period type

optFYstart

A string in the format of "MM-DD" representing the start of financial year, e.g. "01-01" for 1st of January or "07-01" for 1st of July. This package caters for financial years that have a fixed start date. It does not cater for moving dates e.g. last Friday of September.

Value

An integer vector containing the current financial year if offset offset_period is 0, otherwise add the offset offset_period in years.

See also

Other business date functions: get_boundary, get_fy, period_boundaries

Examples

FY() ## return the current financial year as integer - deprecated function
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2019
dt <- as.Date(c("01-01-2018", "15-12-2017"), "%d-%m-%Y") FY(date = dt[1])
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2018
FY(date = dt)
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2018 2018
FY(offset_period = 1) ## return the next financial year as integer
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2020
FY(date = dt[1], offset_period = 1)
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2019
FY(date = dt, offset_period = 1)
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2019 2019
FY(offset_period=-1) ## return the previous financial year as integer
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2018
FY(date = dt[1], offset_period = -1)
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2017
FY(date = dt, offset_period = -1)
#> Warning: FY deprecated, replaced by get_fy
#> [1] 2017 2017
# NOT RUN { FY("a") ## will fail because dates are expected. # }