Calculate Wide-Format Treatment Scheme Events
get_scheme_events_wide.RdThis function and returns the results in a wide-format data frame.
Value
A data frame with columns for event ID, pathogen group, and one column for each treatment scheme containing the sum of log-reduction values for that scheme.
Details
This function does the same thing as kwb.qmra::get_scheme_events_wide(), 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 get_scheme_events_wide
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
treatment_data <- get_treatment_data(config$treatment$processes, n_repeatings = 5, n_events = 3)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.500000, max: 1.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 3.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 4.000000, max: 6.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 3.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 5.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 3.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 5.000000, max: 8.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 5.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 5.000000, max: 8.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 5.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 2.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 3.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 3.000000, max: 16.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 4.500000, max: 12.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 4.000000, max: 6.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 1.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 1.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 1.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 2.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 7.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 1.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 4.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 6.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 6.000000)
#> Create 5 random distribution(s): uniform (n: 3, min: 0.000000, max: 6.000000)
#> Simulated treatment: Q.1 - Activated Sludge for Bacteria
#> Simulated treatment: Q.1 - Activated Sludge for Viruses
#> Simulated treatment: Q.1 - Activated Sludge for Protozoa
#> Simulated treatment: Q.2 - Maturation Pond for Bacteria
#> Simulated treatment: Q.2 - Maturation Pond for Viruses
#> Simulated treatment: Q.2 - Maturation Pond for Protozoa
#> Simulated treatment: Q.3 - UV Reactor for Bacteria
#> Simulated treatment: Q.3 - UV Reactor for Viruses
#> Simulated treatment: Q.3 - UV Reactor for Protozoa
#> Simulated treatment: Q.4 - Sand Filter and UV for Bacteria
#> Simulated treatment: Q.4 - Sand Filter and UV for Viruses
#> Simulated treatment: Q.4 - Sand Filter and UV for Protozoa
#> Simulated treatment: Q.5 - Microfiltration and UV for Bacteria
#> Simulated treatment: Q.5 - Microfiltration and UV for Viruses
#> Simulated treatment: Q.5 - Microfiltration and UV for Protozoa
#> Simulated treatment: Q.6 - Chlorination for Bacteria
#> Simulated treatment: Q.6 - Chlorination for Viruses
#> Simulated treatment: Q.6 - Chlorination for Protozoa
#> Simulated treatment: Q.7 - Microfiltration and UV and Chlorination for Bacteria
#> Simulated treatment: Q.7 - Microfiltration and UV and Chlorination for Viruses
#> Simulated treatment: Q.7 - Microfiltration and UV and Chlorination for Protozoa
#> Simulated treatment: P.1 - Non-edilble crop for Bacteria
#> Simulated treatment: P.1 - Non-edilble crop for Viruses
#> Simulated treatment: P.1 - Non-edilble crop for Protozoa
#> Simulated treatment: P.2 - Distance of 70m for Bacteria
#> Simulated treatment: P.2 - Distance of 70m for Viruses
#> Simulated treatment: P.2 - Distance of 70m for Protozoa
#> Simulated treatment: P.3 - Night-time irrigation for Bacteria
#> Simulated treatment: P.3 - Night-time irrigation for Viruses
#> Simulated treatment: P.3 - Night-time irrigation for Protozoa
#> Simulated treatment: P.4 - Shutdown irrigation in strong winds for Bacteria
#> Simulated treatment: P.4 - Shutdown irrigation in strong winds for Viruses
#> Simulated treatment: P.4 - Shutdown irrigation in strong winds for Protozoa
#> Simulated treatment: P.5 - Natural die-off for Bacteria
#> Simulated treatment: P.5 - Natural die-off for Viruses
#> Simulated treatment: P.5 - Natural die-off for Protozoa
#> Simulated treatment: P.6 - Agri-food processing for Bacteria
#> Simulated treatment: P.6 - Agri-food processing for Viruses
#> Simulated treatment: P.6 - Agri-food processing for Protozoa
#> Simulated treatment: P.7 - Cooking for Bacteria
#> Simulated treatment: P.7 - Cooking for Viruses
#> Simulated treatment: P.7 - Cooking for Protozoa
#> Simulated treatment: P.8 - Drying for Bacteria
#> Simulated treatment: P.8 - Drying for Viruses
#> Simulated treatment: P.8 - Drying for Protozoa
#> Simulated treatment: P.9 - Peeling for Bacteria
#> Simulated treatment: P.9 - Peeling for Viruses
#> Simulated treatment: P.9 - Peeling for Protozoa
#> Simulated treatment: P.10 - Rinsing with drinking water for Bacteria
#> Simulated treatment: P.10 - Rinsing with drinking water for Viruses
#> Simulated treatment: P.10 - Rinsing with drinking water for Protozoa
#> Simulated treatment: P.11 - Washing with disinfectant for Bacteria
#> Simulated treatment: P.11 - Washing with disinfectant for Viruses
#> Simulated treatment: P.11 - Washing with disinfectant for Protozoa
#> Simulated treatment: E.1 - Automatic irrigation for Bacteria
#> Simulated treatment: E.1 - Automatic irrigation for Viruses
#> Simulated treatment: E.1 - Automatic irrigation for Protozoa
#> Simulated treatment: E.2 - Mechanised crop maintenance for Bacteria
#> Simulated treatment: E.2 - Mechanised crop maintenance for Viruses
#> Simulated treatment: E.2 - Mechanised crop maintenance for Protozoa
#> Simulated treatment: E.3 - Mechanised harvesting for Bacteria
#> Simulated treatment: E.3 - Mechanised harvesting for Viruses
#> Simulated treatment: E.3 - Mechanised harvesting for Protozoa
#> Simulated treatment: E.4 - Signage for Bacteria
#> Simulated treatment: E.4 - Signage for Viruses
#> Simulated treatment: E.4 - Signage for Protozoa
#> Simulated treatment: E.5 - Fences for Bacteria
#> Simulated treatment: E.5 - Fences for Viruses
#> Simulated treatment: E.5 - Fences for Protozoa
#> Simulated treatment: E.7 - Sheet mulching for Bacteria
#> Simulated treatment: E.7 - Sheet mulching for Viruses
#> Simulated treatment: E.7 - Sheet mulching for Protozoa
#> Simulated treatment: E.8 - Personnal Protective Equipement for Bacteria
#> Simulated treatment: E.8 - Personnal Protective Equipement for Viruses
#> Simulated treatment: E.8 - Personnal Protective Equipement for Protozoa
#> Simulated treatment: E.1.1 - Micro-sprinkler for Bacteria
#> Simulated treatment: E.1.1 - Micro-sprinkler for Viruses
#> Simulated treatment: E.1.1 - Micro-sprinkler for Protozoa
#> Simulated treatment: E.1.2 - Surface drip irrigation for Bacteria
#> Simulated treatment: E.1.2 - Surface drip irrigation for Viruses
#> Simulated treatment: E.1.2 - Surface drip irrigation for Protozoa
#> Simulated treatment: E.1.3 - Subsurface drip irrigation for Bacteria
#> Simulated treatment: E.1.3 - Subsurface drip irrigation for Viruses
#> Simulated treatment: E.1.3 - Subsurface drip irrigation for Protozoa
#> Simulated treatment: Q.1 - Activated Sludge for Bacteria
#> Simulated treatment: Q.1 - Activated Sludge for Viruses
#> Simulated treatment: Q.1 - Activated Sludge for Protozoa
#> Simulated treatment: Q.2 - Maturation Pond for Bacteria
#> Simulated treatment: Q.2 - Maturation Pond for Viruses
#> Simulated treatment: Q.2 - Maturation Pond for Protozoa
#> Simulated treatment: Q.3 - UV Reactor for Bacteria
#> Simulated treatment: Q.3 - UV Reactor for Viruses
#> Simulated treatment: Q.3 - UV Reactor for Protozoa
#> Simulated treatment: Q.4 - Sand Filter and UV for Bacteria
#> Simulated treatment: Q.4 - Sand Filter and UV for Viruses
#> Simulated treatment: Q.4 - Sand Filter and UV for Protozoa
#> Simulated treatment: Q.5 - Microfiltration and UV for Bacteria
#> Simulated treatment: Q.5 - Microfiltration and UV for Viruses
#> Simulated treatment: Q.5 - Microfiltration and UV for Protozoa
#> Simulated treatment: Q.6 - Chlorination for Bacteria
#> Simulated treatment: Q.6 - Chlorination for Viruses
#> Simulated treatment: Q.6 - Chlorination for Protozoa
#> Simulated treatment: Q.7 - Microfiltration and UV and Chlorination for Bacteria
#> Simulated treatment: Q.7 - Microfiltration and UV and Chlorination for Viruses
#> Simulated treatment: Q.7 - Microfiltration and UV and Chlorination for Protozoa
#> Simulated treatment: P.1 - Non-edilble crop for Bacteria
#> Simulated treatment: P.1 - Non-edilble crop for Viruses
#> Simulated treatment: P.1 - Non-edilble crop for Protozoa
#> Simulated treatment: P.2 - Distance of 70m for Bacteria
#> Simulated treatment: P.2 - Distance of 70m for Viruses
#> Simulated treatment: P.2 - Distance of 70m for Protozoa
#> Simulated treatment: P.3 - Night-time irrigation for Bacteria
#> Simulated treatment: P.3 - Night-time irrigation for Viruses
#> Simulated treatment: P.3 - Night-time irrigation for Protozoa
#> Simulated treatment: P.4 - Shutdown irrigation in strong winds for Bacteria
#> Simulated treatment: P.4 - Shutdown irrigation in strong winds for Viruses
#> Simulated treatment: P.4 - Shutdown irrigation in strong winds for Protozoa
#> Simulated treatment: P.5 - Natural die-off for Bacteria
#> Simulated treatment: P.5 - Natural die-off for Viruses
#> Simulated treatment: P.5 - Natural die-off for Protozoa
#> Simulated treatment: P.6 - Agri-food processing for Bacteria
#> Simulated treatment: P.6 - Agri-food processing for Viruses
#> Simulated treatment: P.6 - Agri-food processing for Protozoa
#> Simulated treatment: P.7 - Cooking for Bacteria
#> Simulated treatment: P.7 - Cooking for Viruses
#> Simulated treatment: P.7 - Cooking for Protozoa
#> Simulated treatment: P.8 - Drying for Bacteria
#> Simulated treatment: P.8 - Drying for Viruses
#> Simulated treatment: P.8 - Drying for Protozoa
#> Simulated treatment: P.9 - Peeling for Bacteria
#> Simulated treatment: P.9 - Peeling for Viruses
#> Simulated treatment: P.9 - Peeling for Protozoa
#> Simulated treatment: P.10 - Rinsing with drinking water for Bacteria
#> Simulated treatment: P.10 - Rinsing with drinking water for Viruses
#> Simulated treatment: P.10 - Rinsing with drinking water for Protozoa
#> Simulated treatment: P.11 - Washing with disinfectant for Bacteria
#> Simulated treatment: P.11 - Washing with disinfectant for Viruses
#> Simulated treatment: P.11 - Washing with disinfectant for Protozoa
#> Simulated treatment: E.1 - Automatic irrigation for Bacteria
#> Simulated treatment: E.1 - Automatic irrigation for Viruses
#> Simulated treatment: E.1 - Automatic irrigation for Protozoa
#> Simulated treatment: E.2 - Mechanised crop maintenance for Bacteria
#> Simulated treatment: E.2 - Mechanised crop maintenance for Viruses
#> Simulated treatment: E.2 - Mechanised crop maintenance for Protozoa
#> Simulated treatment: E.3 - Mechanised harvesting for Bacteria
#> Simulated treatment: E.3 - Mechanised harvesting for Viruses
#> Simulated treatment: E.3 - Mechanised harvesting for Protozoa
#> Simulated treatment: E.4 - Signage for Bacteria
#> Simulated treatment: E.4 - Signage for Viruses
#> Simulated treatment: E.4 - Signage for Protozoa
#> Simulated treatment: E.5 - Fences for Bacteria
#> Simulated treatment: E.5 - Fences for Viruses
#> Simulated treatment: E.5 - Fences for Protozoa
#> Simulated treatment: E.7 - Sheet mulching for Bacteria
#> Simulated treatment: E.7 - Sheet mulching for Viruses
#> Simulated treatment: E.7 - Sheet mulching for Protozoa
#> Simulated treatment: E.8 - Personnal Protective Equipement for Bacteria
#> Simulated treatment: E.8 - Personnal Protective Equipement for Viruses
#> Simulated treatment: E.8 - Personnal Protective Equipement for Protozoa
#> Simulated treatment: E.1.1 - Micro-sprinkler for Bacteria
#> Simulated treatment: E.1.1 - Micro-sprinkler for Viruses
#> Simulated treatment: E.1.1 - Micro-sprinkler for Protozoa
#> Simulated treatment: E.1.2 - Surface drip irrigation for Bacteria
#> Simulated treatment: E.1.2 - Surface drip irrigation for Viruses
#> Simulated treatment: E.1.2 - Surface drip irrigation for Protozoa
#> Simulated treatment: E.1.3 - Subsurface drip irrigation for Bacteria
#> Simulated treatment: E.1.3 - Subsurface drip irrigation for Viruses
#> Simulated treatment: E.1.3 - Subsurface drip irrigation for Protozoa
treatment_events_wide <- treatment_data$events |> tidyr::spread(
key = TreatmentID,
value = logreduction
)
# Apply get_scheme_events_wide
scheme_events_wide <- get_scheme_events_wide(config, treatment_events_wide)
# Print results
print(scheme_events_wide)
#> eventID PathogenGroup scheme_1
#> 1 1 Bacteria 5.744675
#> 2 1 Protozoa 5.457919
#> 3 1 Viruses 6.954098
#> 4 2 Bacteria 3.254498
#> 5 2 Protozoa 4.792236
#> 6 2 Viruses 5.348808
#> 7 3 Bacteria 3.936736
#> 8 3 Protozoa 4.563489
#> 9 3 Viruses 5.446051
#> 10 1 Bacteria 6.058529
#> 11 1 Protozoa 4.027693
#> 12 1 Viruses 5.831451
#> 13 2 Bacteria 6.975944
#> 14 2 Protozoa 6.838629
#> 15 2 Viruses 6.767765
#> 16 3 Bacteria 3.523057
#> 17 3 Protozoa 3.777046
#> 18 3 Viruses 6.584153
#> 19 1 Bacteria 5.900947
#> 20 1 Protozoa 6.615795
#> 21 1 Viruses 5.197320
#> 22 2 Bacteria 6.372433
#> 23 2 Protozoa 6.160738
#> 24 2 Viruses 6.849187
#> 25 3 Bacteria 3.663325
#> 26 3 Protozoa 6.571818
#> 27 3 Viruses 6.252463
#> 28 1 Bacteria 3.461258
#> 29 1 Protozoa 4.018616
#> 30 1 Viruses 6.053819
#> 31 2 Bacteria 5.732444
#> 32 2 Protozoa 6.026708
#> 33 2 Viruses 6.481186
#> 34 3 Bacteria 3.715208
#> 35 3 Protozoa 6.046402
#> 36 3 Viruses 5.571602
#> 37 1 Bacteria 4.879210
#> 38 1 Protozoa 4.638871
#> 39 1 Viruses 6.839068
#> 40 2 Bacteria 4.341442
#> 41 2 Protozoa 6.146132
#> 42 2 Viruses 6.072621
#> 43 3 Bacteria 6.441558
#> 44 3 Protozoa 5.523235
#> 45 3 Viruses 6.145546