 

 

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]]


