Skip to content

replicate rows

4 messages · Schumacher, G., Ernest Adrogué, jim holtman +1 more

#
3-02-2012, 11:26 (+0000); Schumacher, G. escriu:
If x is your matrix, this

x[rep(1:17, 20),]

will give you a matrix with 340 rows and 20 columns which I think is
what you want.

Cheers,
Ernest
#
It is not clear to me exactly what you are trying to do.  Can you show
a short example of some input and then what the output would look
like?

When you say you only "want to replicated the rows", what happens to
the columns?  Is each matrix going to have only one column?

So some more clarification would be nice.
On Fri, Feb 3, 2012 at 6:26 AM, Schumacher, G. <g.schumacher at vu.nl> wrote:

  
    
#
Hi>
matrix
Replicate index.
x<-matrix(1:4, 2,2)
x[rep(1:2, 20),]

Regards
Petr
http://www.R-project.org/posting-guide.html