Merge example Posted byrodrigobeas@gmail.com 2014-08-23 This is an example of how to use the function “Merge” in R. Create a data frame 1: df1 = data.frame(id=c(1:6),Product=c(rep("Toaster",3),rep("Radio",3))) Create a second data frame: df2 = data.frame(id=c(2,4,6),State=c(rep("Alabama",2),rep("Ohio",1))) Now, merge both data frames: both<-merge(df1, df2) Another way to do it: both<-merge(df1, df2, all.x=TRUE) Yet another way: both<-merge(df1, df2, all=FALSE) Post navigation Previous Post Previous post: Isla Magdalena con Reef CheckNext Post Next post: floating forests