This may sound simple but I can't find a good way to do it.
tmp is a data.frame with elements
a 1
c 2
b 5
b 4
a 4
c 3
I want to replicate each row 3 times. i.e.
a 1
a 1
a 1
c 2
c 2
c 2
b 5
b 5
b 5
b 4
b 4
b 4
a 4
a 4
a 4
a 4
c 3
c 3
c 3
The original problem has a lot more rows, columns, and replications.
I notice that I can stack a data.frame with
apply(tmp,2,rep,3)
But this stacks the entire tmp 3 times, which require a sort operation
to get the form that I need. However, the sort operation alters the
rows of another frame that I would like to merge with. Any suggestion
will be appreciated. I am running Splus 4.5 under Window 95.
Winson Taam
Department of Math. & Stat.
Oakland University
Rochester, MI 48309
tel: 248-370-3438
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|