A simple test function that always returns 1, useful for testing the Plan framework's functionality.
See also
vignette("plnr") for the data/argset contract. An action
function must accept at least the supplied data and argset values; it may
take further arguments, and a directly supplied fn receives the argset
positionally, so its second formal need not be named argset.
Other example and test functions:
example_action_fn(),
example_data_fn_nor_covid19_cases_by_time_location()
Examples
# Called directly, it ignores both arguments and returns 1
test_action_fn(data = list(), argset = list())
#> [1] 1
# Its intended use is as a placeholder action function inside a plan
p <- plnr::Plan$new()
p$add_data(
name = "deaths",
direct = data.table::data.table(deaths = 1:4, year = 2001:2004)
)
p$add_analysis(name = "analysis_1", fn_name = "plnr::test_action_fn")
p$run_one("analysis_1")
#> [1] 1
