Skip to content

how to add a 'label' column

5 messages · Jason Love, Rui Barradas, Marc Schwartz +1 more

#
Hello,

Try

score2$subject <- rep(score$subject, 7)

Hope this helps,

Rui Barradas

Em 01-06-2012 20:47, Jason Love escreveu:
#
Just to throw out an alternative using the ?reshape function:

# See the example using 'df3' on the help page
DF.Long <- reshape(score, direction = "long", idvar = "subject", 
                   varying = 2:8, sep = "")
subject time    test
ab.1      ab    1 0.17687
cl.1      cl    1 0.18020
ds.1      ds    1 0.14269
ex.1      ex    1 0.14626
ey.1      ey    1 0.16850
js.1      js    1 0.13741
ms.1      ms    1 0.14548
pk.1      pk    1 0.16246
ro.1      ro    1 0.18631
rt.1      rt    1 0.14805
sc.1      sc    1 0.15510
yk.1      yk    1 0.18077
ab.2      ab    2 0.16715
cl.2      cl    2 0.16618
ds.2      ds    2 0.12857
ex.2      ex    2 0.12874
ey.2      ey    2 0.15654
js.2      js    2 0.15516
ms.2      ms    2 0.16655
pk.2      pk    2 0.14872
ro.2      ro    2 0.16128
rt.2      rt    2 0.15794
sc.2      sc    2 0.16374
yk.2      yk    2 0.17320


Regards,

Marc Schwartz
On Jun 1, 2012, at 3:06 PM, Rui Barradas wrote:

            
#
On 06/02/2012 05:47 AM, Jason Love wrote:
Hi Jason,
Perhaps this will do what you want.

library(prettyR)
rep_n_stack(score,to.stack=paste("test",1:7,sep=""))

Jim