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 ?
It seems to be a common request to be able to identify the matched observation or the source, is
flaga good name ?flagwould be a character vector of length 1 to 3 containing either :TRUEfor matched observationTRUEwhen the observation was matched respectively in.xor.yflagwould beNULLby defaultImplementation wise we mutate some columns on each side, named as the first 2 elements of
flag, or unique temp names from the uniqueflagelement, then join, fill with FALSE, and combine accordingly.Common use case would probably be :
In the latter case
select_keys_and()is a bit awkwar, it is worth havingselect_keys()which would do the same but be more limited in scope and look better ?