[R] inadverted reordering of a df column when it is copied to another df
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Fri Mar 17 17:58:58 CET 2017
Reprex confirming Bert:
A <- data.frame( y = 1L:40000L )
B <- data.frame( x = 1L:40000L )
A$x <- B$x
plot(B$x)
#' ![](http://i.imgur.com/cXSFsBh.png)
Care to demonstrate for us, Karl?
https://cran.r-project.org/web/packages/reprex/README.html
On Fri, 17 Mar 2017, Bert Gunter wrote:
> You are wrong. No reordering occurs.
>
> Cheers,
> Bert
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Fri, Mar 17, 2017 at 8:05 AM, Karl Schilling
> <karl.schilling at uni-bonn.de> wrote:
>> 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
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
More information about the R-help
mailing list