Left join only selected columns in R with the merge() function
问题 I am trying to LEFT Join 2 data frames but I do not want join all the variables from the second data set: As an example, I have dataset 1 (DF1): Cl Q Sales Date A 2 30 01/01/2014 A 3 24 02/01/2014 A 1 10 03/01/2014 B 4 10 01/01/2014 B 1 20 02/01/2014 B 3 30 03/01/2014 And I would like to left join dataset 2 (DF2): Client LO CON A 12 CA B 11 US C 12 UK D 10 CA E 15 AUS F 91 DD I am able to left join with the following code: merge(x = DF1, y = DF2, by = "Client", all.x=TRUE) : Client Q Sales