Let's say I have these 3 dataframes (In my case I have tens of such data frames).
library(dplyr)
dm1 = data.frame(x = 1:10, y = 20:29)
dm2 = data.frame(x = 1:5, z = 100:104)
dm3 = data.frame(x = 2:8, m = 200:206)
and I wish to merge them using the function left_join
so that the merge can take into account the column x. When I am trying to use this function, I am able to merge only two dataframes together but not the 3 all at once. The desired output is as follows
x y z m
1 1 20 100 NA
2 2 21 101 200
3 3 22 102 201
4 4 23 103 202
5 5 24 104 203
6 6 25 NA 204
7 7 26 NA 205
8 8 27 NA 206
9 9 28 NA NA
10 10 29 NA NA