Left join only selected columns in R with the merge() function

后端 未结 3 1094
难免孤独
难免孤独 2020-12-07 17:38

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         


        
3条回答
  •  旧巷少年郎
    2020-12-07 17:58

    Nothing elegant but this could be another satisfactory answer.

    merge(x = DF1, y = DF2, by = "Client", all.x=TRUE)[,c("Client","LO","CON")]
    

    This will be useful especially when you don't need the keys that were used to join the tables in your results.

提交回复
热议问题