Skip to contents

This function simulates treatment data for pathogen processes based on the provided configuration. It generates treatment events and parameters, and can return results in either long or wide format.

Usage

simulate_treatment(config, wide = FALSE, debug = TRUE, lean = FALSE)

Arguments

config

A configuration object containing treatment scheme and process information.

wide

Logical indicating whether to return results in wide format.

debug

Logical indicating whether to print debug information.

lean

Logical indicating whether to return only essential results for web applications.

Value

If lean is TRUE, returns a list containing only the long-format treatment events. If wide is TRUE, returns a list containing long-format events, wide-format events, wide-format scheme events, treatment schemes, and treatment parameters. If wide is FALSE, returns a list containing long-format events, treatment schemes, and treatment parameters.

Details

This function does the same thing as kwb.qmra::simulate_treatment(), but it is bundled with ambre to avoid a hard dependency on the unmaintained package.

References

Sonnenberg H (2024). kwb.utils: General Utility Functions Developed at KWB. R package version 0.15.0 URL: https://github.com/kwb-r/kwb.utils (MIT Licence)

Examples

# Example usage of simulate_treatment
# \donttest{
scenario_test <- create_scenario(
  system.file("input_1culture_2pop.xlsx", package = "ambre")
)
scenario_updated <- update_pathogen(scenario = scenario_test,
 pathoName = c("Campylobacter jejuni","Rotavirus"))
config <- scenario_updated$config[[1]]

# Simulate treatment data
result <- simulate_treatment(config, wide = TRUE, debug = FALSE, lean = FALSE)
#> Joining with `by = join_by(TreatmentID)`
#> Joining with `by = join_by(TreatmentID)`

# }