[Rd] 'sep' argument in reshape()

Stephen Weigand weigand.stephen at gmail.com
Wed Apr 1 01:33:05 CEST 2009


I wonder if the 'sep' argument in reshape() is being ignored
unintentionally:

## From example(reshape)
 df <- data.frame(id=rep(1:4,rep(2,4)),
                  visit=I(rep(c("Before","After"),4)),
                  x=rnorm(4), y=runif(4))

reshape(df, timevar="visit", idvar="id", direction="wide", sep = "_")

  id x.Before y.Before x.After y.After
1  1    0.773    0.293  -0.021   0.658
3  2   -0.518    0.351  -0.623   0.946
5  3    0.773    0.293  -0.021   0.658
7  4   -0.518    0.351  -0.623   0.946

Is this more of the intended result when 'sep = "_"'?

  id x_Before y_Before x_After y_After
1  1    0.773    0.293  -0.021   0.658
3  2   -0.518    0.351  -0.623   0.946
5  3    0.773    0.293  -0.021   0.658
7  4   -0.518    0.351  -0.623   0.946

Thanks,

Stephen
-- 
Rochester, Minn. USA



More information about the R-devel mailing list