r - Add data frames row wise with [d]plyr -
i have 2 data frames
df1 # b # 1 10 20 # 2 11 21 # 3 12 22 # 4 13 23 # 5 14 24 # 6 15 25 df2 # b # 1 4 8
i want following output:
df3 # b # 1 14 28 # 2 15 29 # 3 16 30 # 4 17 31 # 5 18 32 # 6 19 33
i.e. add df2 each row of df1.
is there way desired output using plyr (mdplyr??) or dplyr?
i see no reason "dplyr" this. in base r do:
df1 + unclass(df2) # b # 1 14 28 # 2 15 29 # 3 16 30 # 4 17 31 # 5 18 32 # 6 19 33
which same df1 + list(4, 8)
.
Comments
Post a Comment