Skip to content

conflict when there is no match #40

@moodymudskipper

Description

@moodymudskipper

From a SO question :

site_1 <- tibble::tribble(
    ~diagnosis, ~wk2, ~wk3, ~wk4,
  "condition1",    1,    4,   10,
  "condition2",    0,   10,    4,
)

site_2 <- tibble::tribble(
    ~diagnosis, ~wk1, ~wk2, ~wk3, ~wk4,
  "condition1",    6,    0,    4,    7,
  "condition2",    0,    8,    9,    0,
)

site_3 <- tibble::tribble(
    ~diagnosis,  ~wk1, ~wk2, ~wk3, ~wk4,
  "condition1",    6,    0,    4,    7,
  "condition2",    8,    9,    0,    0,
  "condition3",    3,   11,   11,   12,
)

powerjoin::power_full_join(
  list(site_1, site_2, site_3),
  by = "diagnosis",
  conflict = `+`
)
#> # A tibble: 3 × 5
#>   diagnosis    wk1   wk2   wk3   wk4
#>   <chr>      <dbl> <dbl> <dbl> <dbl>
#> 1 condition1    12     1    12    24
#> 2 condition2     8    17    19     4
#> 3 condition3    NA    NA    NA    NA

Created on 2023-03-17 with reprex v2.0.2

I would have liked it to work but this makes sense, on row 3 we are adding to NA since condition3 is set to NA for site_1 and site_2.

Should the conflict resolution be applied only when there is a match ? If so this shouldn't be the general case because maybe we want the lhs squared times the res for example, and then unmatched is really NA.

Maybe a better solution is to make fill be applied before the conflict resolution, then it would work with fill = 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions