I am getting a novel error message, which I am unable to debug. I have two data sets x, x2:
ID returns.x returns.y
111111118 0.012852 -0.001436
1145JXAP4 0.000000 0.025316
114LYTBB1 -0.090909 0.100000
114R88BT4 0.000000 0.000000
114Y4KDH0 -0.055344 -0.094950
1198CUV40 0.016043 0.005263
and
ID returns
111111118 -0.043392
11D7GQAK9 0.000000
11JS8VT41 -0.036116
11NJGF6V7 0.开发者_开发知识库000000
11NSZA7T1 0.113978
11STQQNH7 0.000000
when giving a merge(x, x2, by = "ID", all = TRUE)
I obtain a message
Error in match.names(clabs, names(xi)) :
names do not match previous names
What's the culprit?
I'd put it somewhere between unlucky and a bug. IIRC the .x
and .y
are the default added extension. Just using something else works just fine. This should be equivalent:
> A <- data.frame(ID=1:3, rx=rnorm(3), ry=rnorm(3))
> B <- data.frame(ID=c(1,3,5), ret=rnorm(3))
> merge(A, B, by="ID", all=TRUE)
ID rx ry ret
1 1 0.45260 -0.21953 -0.56536
2 2 0.35250 -1.35109 NA
3 3 -0.56535 1.24298 -0.13605
4 5 NA NA 0.42105
>
精彩评论