Skip to contents

cfbseedR supports custom functions to compute results in season simulations through the compute_results argument of cfb_simulations(). This function verifies that a custom function behaves as the simulator expects, mirroring nflseedR's simulations_verify_fct(). It checks the output structure and whether game results are changed as expected, and errors with a hint at the first problem found.

Usage

simulations_verify_fct(compute_results, ..., games = NULL, teams = NULL)

Arguments

compute_results

A function to compute results of games. Required arguments: teams, games, week_num. It must return list(teams = teams, games = games) without removing rows or columns from games, must fill result for exactly the games with week == week_num & is.na(result), must not modify any other result, and must not produce ties (result == 0) outside the regular season.

...

Further arguments passed on to compute_results.

games

A schedule where some results are missing. Defaults to the bundled toy season with all results from week 3 onwards blanked.

teams

A teams table (team, conference, optionally sim). Defaults to the bundled toy teams.

Value

Returns TRUE invisibly if no problems are found.

Examples

# \donttest{
simulations_verify_fct(cfbseedR_compute_results)
# }