[R] inadverted reordering of a df column when it is copied to another df

Karl Schilling karl.schilling at uni-bonn.de
Fri Mar 17 16:05:35 CET 2017


Dear all:

I have two data.frames A and B of the same number of rows (about 
40,000). I realized that when I copy column x from data.frame A to B, 
the order of this column  gets changed. This seems to affect only values 
in rownumbers > ~ 35/36,000. It also happens in any of the following 
three approaches:

A$x <- B$x

x <- B$x (here, x is still in the correct order)
B$x <- x : now x is reordered

B <- cbind(A, B$x)

I am working with Windows7Pro/64bit, R 3.3.3, and RStudio 0.99.903.

Any help would be appreciated.

Best regards

Karl Schilling



More information about the R-help mailing list