Many functions expect financial years. Determining that they are validly entered is often quite computationally costly, relative to the core calculations. These internal functions provide mechanisms to check validity quickly, while still providing clear, accurate error messages.
validate_fys_permitted(to_verify, permitted_fys, min.yr = NULL,
max.yr = NULL, deparsed = deparse(substitute(to_verify)),
allow.projection = TRUE,
earliest_permitted_financial_year = "earliest permitted financial year",
latest_permitted_financial_year = "latest permitted financial year")
A user-provided value, purporting to be character vector of financial years.
A character vector of valid financial years.
Integers specifying the range of to_verify
.
If NULL
, no restriction on the upper or lower bound of the range.
A string indicating the argument that the user provided. Should generally be provided explicitly as the default is unlikely to be user-friendly.
If FALSE
emit a different error message.
Text
for earliest/latest permitted financial year when min.yr
/max.yr
condition is violated.
If to_verify
contains valid financial years
they are returned all in the form 2013-14
. If they were
already in that form, they obtain the following attributes:
grattan_all_fy
TRUE
if all the financial years are valid.
grattan_min_yr
An integer, the earliest year ending in to_verify
.
grattan_max_yr
An integer, the latest year ending in to_verify
.