R doesn't like me today...
I have two tables asembled via cbind(). Tab 1 (dwd_nogap) is
x1 col1_x1 col2_x1
A "1982 12 01 00:00" " 0.4" " 0"
B "1982 12 02 00:00" " -0.5" " 0"
C "1982 12 03 00:00" " -0.2" " 0"
D "1982 12 04 00:00" " -1" " 0.1"
E "1982 12 05 00:00" " -0.9" " 0"
F "1982 12 06 00:00" " 3.7" " 4.1"
Tab 2 (dwd_gap) is:
x2 col1_x2 col2_x2
[1,] "1982 12 01 00:00" " 0.4" " 0"
[2,] "1982 12 03 00:00" " -0.2" " 0"
[3,] "1982 12 04 00:00" " -1" " 0.1"
[4,] "1982 12 05 00:00" " -0.9" " 0"
[5,] "1982 12 06 00:00" " 3.7" " 4.1"
[6,] "1982 12 07 00:00" " 7" " 5.8"
My merge command is:
exporttab <- merge(x=dwd_nogap,y=dwd_gap,by.x=dwd_nogap[,1],by.y=dwd_gap[,1], fill=-9999)
In my opinion the command is correct, but it's apparently not doing well...
Error in fix.by(by.x, x) : 'by' must specify uniquely valid columns
Rather give names of the column on which you want to merge:
exporttab <- merge(x=dwd_nogap, y=dwd_gap, by.x='x1', by.y='x2', fill=-9999)
This is what I tried for a right outer join [as per my requirement]:
m1 <- merge(x=companies, y=rounds2, by.x=companies$permalink,
by.y=rounds2$company_permalink, all.y=TRUE)
# Error in fix.by(by.x, x) : 'by' must specify uniquely valid columns
m1 <- merge(x=companies, y=rounds2, by.x=c("permalink"),
by.y=c("company_permalink"), all.y=TRUE)
This worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With