[R] reshape question

From: Hutchins, Reid <reid.hutchins_at_amd.com>
Date: Fri 19 May 2006 - 05:50:02 EST

   

I am a relative R newbie and I am having trouble with reshape() on R V1.9.1 on Linux. The same code appears to be ok when run on R V2.2.0 on Windows and a V2.1 on Linux. Any help would be great as I need to stay on V1.9 for the immediate future... Thanks, Reid Hutchins    

df <- data.frame(state= rep(1:2, each=8), school=rep(1:2,each=4), class=rep(1:2,each=2),Values2Columns=rep(1:2, each=1), score=rnorm(16));

df

wide <- reshape(df, idvar=c("state", "school","class"), timevar = "Values2Columns",direction = "wide")

wide  

#############Linux Result################

 

> wide <- reshape(df, idvar=c("state", "school","class"), timevar =
"Values2Columns",direction = "wide")

Error in "[<-.data.frame"(`*tmp*`, , varying[, i], value = thistime[match(rval[, :

      replacement has 3 rows, data has 8    

#############Windows Result##############

> wide <- reshape(df, idvar=c("state", "school","class"), timevar =
"Values2Columns",direction = "wide")

> wide

   state school class score.1 score.2

1 1 1 1 0.4873844 -0.91870069

3 1 1 2 -0.8898849 0.05065863

5 1 2 1 1.6124764 1.76410014

7 1 2 2 3.1420597 -0.65624539

9 2 1 1 -0.9271927 -0.71839816

11 2 1 2 1.2034488 0.01417184

13 2 2 1 -2.4475057 -1.32513332

15 2 2 2 0.4968306 -0.02531275    

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 19 05:54:51 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 19 May 2006 - 08:10:16 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.