input_checks: Check input to Blockbuster function is valid.

Description Usage Arguments Details Value Examples

Description

This function contains all the input validity checks used by the Blockbuster function. It produces messages and warnings about common scenarios, and errors for invalid data inputs. Currently this function will only report the first error that occurs.

Usage

1
2
3
input_checks(element.data = NULL, block.data = NULL,
  forecast.horizon = NULL, rebuild.money = NULL, repair.money = NULL,
  block.rebuild.cost = NULL, inflation = NULL)

Arguments

element.data

An element-level data frame.

block.data

A block-level data frame.

forecast.horizon

An integer.

rebuild.money

A numeric vector

repair.money

A numeric vector

block.rebuild.cost

A number

inflation

A numeric vector

Details

If block.data is not provided, this function will generate the block-level data.frame.

forecast.horizon must be a single positive number.

inflation, rebuild.money and repair.money must be numeric. If either is a single number then a message is displayed stating that it will be used for each year. If vectors are passed to these arguments, their length must be equal or greater than forecast.horizon, with the additional values being ignored and a message displayed. Negative values will throw an error. A message is displayed if inflation seems excessive (over 200

block.rebuild.cost is checked to be a positive number. If a vector is passed, the values beyond the first will be ignored and a message displayed.

Value

The input is returned as is, with the addition of a block-level data frame if block.data = NULL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# run input checks on a 10 year simulation with no rebuilding, £1M repair
# budget each year with £2,000 unit rebuild cost and no inflation. The block-
# level data frame is not supplied and will be generated.
blockbuster2:::input_checks(element.data = simulated_elements,
               block.data = NULL,
               forecast.horizon = 10,
               rebuild.money = 0,
               repair.money = 1000000,
               block.rebuild.cost = 2000,
               inflation = 1)

DFE-Capital/Blockbuster-2 documentation built on May 26, 2019, 7:23 a.m.