You want the function merge
.
merge
is commonly used to merge two tables by one similar common, but the by
argument can allow multiple columns:
merge(testData, testBounced, by=c("Email", "Campaign"))
All pairs of Email
and Campaign
that don't match will be discarded by default. That's controllable by the arguments all.x
and all.y
, which default to FALSE
.
The default argument for by
is intersect(names(x, y))
, so you technically don't need to specify the columns in this case, but it's good for clarity.