Skip to content
Back to formatted view

Raw Message

Message-ID: <bc47d3330903311633m6e90c73dn32b48d7e984276d4@mail.gmail.com>
Date: 2009-03-31T23:33:05Z
From: Stephen D. Weigand
Subject: 'sep' argument in reshape()

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