Matches an mcnode with a data frame by aligning groups, scenarios, or adding missing groups across different scenarios.
Arguments
- mcmodule
(mcmodule object). Module containing node.
- mc_name
(character). Node name.
- data
(data frame). Data to match with mcnode.
- keys_names
(character vector, optional). Column names for matching. Default: NULL.
- match_scenario
(logical). If TRUE, scenario_id is used for alignment (default behavior). If FALSE, scenario_id is treated as a regular key, enabling cross-scenario matching. Default: TRUE.
Details
Matching proceeds in order:
Group matching — same scenarios but different group order
Scenario matching — same groups but different scenarios
Null matching — add missing groups across different scenarios
Examples
test_data <- data.frame(pathogen=c("a","b"),
inf_dc_min=c(0.05,0.3),
inf_dc_max=c(0.08,0.4))
result<-mc_match_data(imports_mcmodule,"no_detect_a", test_data)
#> Group by: pathogen
#> no_detect_a prev dim: [1001, 1, 6], new dim: [1001, 1, 6], 0 null matches
#> test_data prev dim: [2, 3], new dim: [6, 4], 0 null matches
