Hello, I have a matrix of 17 rows and 20 columns. I want to replicate this matrix 20 times, but I only want to replicate the rows. How do I do that? Kind regards / Met vriendelijke groet / Med venlig hilsen, Dr. Gijs Schumacher Postdoctoral Researcher Department of Political Science and Public Management, University of Southern Denmark & Department of Political Science, VU University Amsterdam Email: gijs@sam.sdu.dk<mailto:gijs@sam.sdu.dk>; g.schumacher@vu.nl<mailto:g.schumacher@fsw.vu.nl> Web: http://www.gijsschumacher.nl<http://www.gijsschumacher.nl/> [[alternative HTML version deleted]]
3-02-2012, 11:26 (+0000); Schumacher, G. escriu:> I have a matrix of 17 rows and 20 columns. I want to replicate this > matrix 20 times, but I only want to replicate the rows. How do I do > that?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:> Hello, > > I have a matrix of 17 rows and 20 columns. I want to replicate this matrix 20 times, but I only want to replicate the rows. How do I do that? > > Kind regards / Met vriendelijke groet / Med venlig hilsen, > > Dr. Gijs Schumacher > Postdoctoral Researcher > Department of Political Science and Public Management, University of Southern Denmark & > Department of Political Science, VU University Amsterdam > > Email: gijs at sam.sdu.dk<mailto:gijs at sam.sdu.dk>; g.schumacher at vu.nl<mailto:g.schumacher at fsw.vu.nl> > Web: http://www.gijsschumacher.nl<http://www.gijsschumacher.nl/> > > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it.
Hi>> Hello, > > I have a matrix of 17 rows and 20 columns. I want to replicate thismatrix> 20 times, but I only want to replicate the rows. How do I do that?Replicate index. x<-matrix(1:4, 2,2) x[rep(1:2, 20),] Regards Petr> > Kind regards / Met vriendelijke groet / Med venlig hilsen, > > Dr. Gijs Schumacher > Postdoctoral Researcher > Department of Political Science and Public Management, University of > Southern Denmark & > Department of Political Science, VU University Amsterdam > > Email: gijs at sam.sdu.dk<mailto:gijs at sam.sdu.dk>; g.schumacher at vu.nl< > mailto:g.schumacher at fsw.vu.nl> > Web: http://www.gijsschumacher.nl<http://www.gijsschumacher.nl/> > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.