R

Asked • 09/19/19

Can dplyr join on multiple columns or composite key?

I realize that `dplyr` v3.0 allows you to join on different variables:`left_join(x, y, by = c("a" = "b")` will match `x.a` to `y.b`However, is it possible to join on a combination of variables or do I have to add a composite key beforehand?Something like this:`left_join(x, y, by = c("a c" = "b d")` to match the concatenation of [`x.a` and `x.c`] to [`y.b` and `y.d`]

1 Expert Answer

By:

William L. answered • 05/26/21

Tutor
5 (87)

Data Scientist and Evaluation Specialist

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.