s-news
[Top] [All Lists]

Re: Replicating the rows of a table n times each

To: "'Tzamouranis, Ioannis C'" <Ioannis.Tzamouranis@constellation.com>, <s-news@wubios.wustl.edu>
Subject: Re: Replicating the rows of a table n times each
From: "Christos Hatzis" <christos@nuverabio.com>
Date: Wed, 10 May 2006 18:16:07 -0400
In-reply-to: <63A1EAD70655E34686AB65DC54113ABB05B58C68@e2km-msw-02.ceg.corp.net>
Organization: Nuvera Biosciences
Reply-to: <christos@nuverabio.com>
Thread-index: AcZ0cF1rkjjL9I1hTjq7s8bepbeh1wADEeoAAACmmGA=
This works in R - don't have S-Plus loaded any more:

 df <- rbind(1:4,LETTERS[1:4],5:8,letters[1:4])
 df[ rep(c(1:nrow(df)),each=3), ]

-Christos  

-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Tzamouranis,
Ioannis C
Sent: Wednesday, May 10, 2006 6:01 PM
To: s-news@wubios.wustl.edu
Subject: [S] Replicating the rows of a table n times each

Hello,

Other than looping to produce this, is there a way to replicate the rows of
a table n times each so that a table such as:
1 2 3 4
A B C D
5 6 7 8
a b c d

become

1 2 3 4
1 2 3 4
1 2 3 4
A B C D
A B C D
A B C D
5 6 7 8
5 6 7 8
5 6 7 8
a b c d
a b c d
a b c d
(where in this case n=3)?

Thanks,

Yannis T
>>> This e-mail and any attachments are confidential, may contain legal,
professional or other privileged information, and are intended solely for
the addressee.  If you are not the intended recipient, do not use the
information in this e-mail in any way, delete this e-mail and notify the
sender. CEG-IP2
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with the
BODY of the message:  unsubscribe s-news




<Prev in Thread] Current Thread [Next in Thread>