Refactor/remove checks in functions
philmikejones opened this issue · comments
Checks in the middle or at the end of the functions should be refactored or removed, or moved to tests/
. Currently they're hard to test so code coverage isn't complete.
Example, rk_weight()
:
# The sum of weights will form the simulated population so this must match
# the population from cons
if (!isTRUE(all.equal(sum(weights), (sum(cons) / length(vars))))) {
stop("Weight populations don't match constraint populations.
Usually this means the populations for each of your constraints
are slightly different\n",
"Sum of simulated population: ", sum(weights), "\n",
"Sum of constraint population: ", (sum(cons) / length(vars)))
}