grattan (version 1.7.1.2)

validate_per: Validate per

Description

Checks whether a valid input of `per` is used and outputs the amount which yearly payments are divided by to get the desired rate.

Usage

validate_per(per, missing_per, .fortnights_per_yr = 26)

Arguments

per

How often are payments made? Can only take values 'year', 'fortnight', or 'quarter'.

missing_per

Is `per` missing in the outer function? If so the default for that function will be used. Essentially, you should always pass missing(per) to this argument.

.fortnights_per_yr

What is the ratio of the fortnightly payment amount to the yearly payment amount? By default, 26. (Some payments expect 26; others expect 364/14.)

Details

For examples, see rent_assistance function code.

Examples

Run this code
# NOT RUN {
# Typical use-case
# attach(asNamespace("grattan"))
z <- function(per = "year") 52 / validate_per(per, missing(per))
z()  # message
z(per = "year")       # same, no message
z(per = "fortnight")  # in fortnights
z(per = "sidfh")      # error
# }
# NOT RUN {

# }

Run the code above in your browser using DataCamp Workspace