This function is a collection of expectations which ensure that the output of reorganise is formally and contentwise correct. It is used in the tests of this package.

.expect_valid_table(
  x = NULL,
  units = 1,
  variables = NULL,
  groups = FALSE,
  flags = FALSE
)

Arguments

x

a table to test.

units

the number of units in the output table (from 1 to 3)

variables

the variables that should be in the output table (either "harvested" or "production")

groups

whether or not groups are in the test table.

flags

whether or not flags are in the test table.

Value

Either an error message of the invalid expectations, or the output of the last successful expectation.