You can do joins as well using Hadley Wickham's awesome [dplyr](http://blog.rstudio.org/2014/01/17/introducing-dplyr/) package. Here is how you can do most of the joins in the original question with dplyr library(dplyr) #make sure that CustomerId cols are both type numeric #they ARE not using the provided code in question and dplyr will complain df1$CustomerId <- as.numeric(df1$CustomerId) df2$CustomerId <- as.numeric(df2$CustomerId) #inner inner_join(df1, df2) #left outer left_join(df1, df2) #right outer (just reverse argument order) left_join(df2, df1)