Skip to content

flag argument ? #48

@moodymudskipper

Description

@moodymudskipper

It seems to be a common request to be able to identify the matched observation or the source, is flag a good name ?

flag would be a character vector of length 1 to 3 containing either :

  • length 1 : The name of a boolean column that would be TRUE for matched observation
  • length 2 : The names of columns containing TRUE when the observation was matched respectively in .x or .y
  • length 3 : The latter + the former

flag would be NULL by default

Implementation wise we mutate some columns on each side, named as the first 2 elements of flag, or unique temp names from the unique flag element, then join, fill with FALSE, and combine accordingly.

Common use case would probably be :

left_join(x, y, flag ="matched")

left_join(
  x,
  y |> select_keys_and(), 
  flag ="matched"
)

In the latter case select_keys_and() is a bit awkwar, it is worth having select_keys() which would do the same but be more limited in scope and look better ?

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