Given two data frames
df1 = data.frame(CustomerId=c(1:6),Product=c(rep("Toaster",3),rep("Radio",3)))
df2 = data.frame(CustomerId=c(2,4,6),State=c(rep("Alabama",2),rep("Ohio",1)))
> df1
CustomerId Product
1 Toaster
2 Toaster
3 Toaster
4 Radio
5 Radio
6 Radio
> df2
CustomerId State
2 Alabama
4 Alabama
6 Ohio
How can I do database style, i.e., sql style, joins? That is, how do I get:
- An inner join of df1 and df1
- An outer join of df1 and df2
- A left outer join of df1 and df2
- A right outer join of df1 and df2
P.S. IKT-JARQ (I Know This - Just Adding R Questions)
Extra credit:
How can I do a sql style select statement?