Matches datasets by group and preserves baseline scenarios (scenario_id=0) when scenarios differ between them.
Value
List containing matched datasets with aligned scenario IDs:
First element: matched version of dataset x
Second element: matched version of dataset y
Examples
x <- data.frame(
category = c("a", "b", "a", "b"),
scenario_id = c(0, 0, 1, 1),
hg = c(1, 2, 1, 2),
value = 1:4
)
y <- data.frame(
category = c("a", "b", "a", "b"),
scenario_id = c(0, 0, 2, 2),
hg = c(1, 2, 1, 2),
value = 5:8
)
# Automatic matching
result <- wif_match(x, y)
#> Group by: category
#> From 4 rows (2 groups, 2 scenarios) and 4 rows (2 groups, 2 scenarios), to 6 rows (2 groups, 3 scenarios)