By using the merge function and its optional parameters: Inner join: Outer join: Left outer: Right outer: Cross join: Just as with the inner join, you would probably want to explicitly pass “CustomerId” to R as the matching variable. I think it’s almost always best to explicitly state the identifiers on which you want to merge; it’s safer if the input data.frames change unexpectedly and easier to read later on. |
|
I would recommend checking out Gabor Grothendieck’s sqldf package, which allows you to express these operations in SQL.
I find the SQL syntax to be simpler and more natural than its R equivalent (but this may just reflect my RDBMS bias). See Gabor’s sqldf Google Code page for more information |