Message-ID: <Pine.LNX.4.31.0211272035071.20698-100000@gannet.stats>
Date: 2002-11-27T20:39:02Z
From: Brian Ripley
Subject: Rbind help needed
In-Reply-To: <4F57EB97.448AD66C.3520D0D0@aol.com>
On Wed, 27 Nov 2002 Bayesianbay at aol.com wrote:
> Dear list
>
> I have a very simple question which is causing me problems!
>
> I have a matrix A and simply want to rbind this matrix together n times (n is a large number)
> How can I write this in R?
> I know I could do new<-rbind(z,z,z,...z) with z written n times but this will take forever as n is so large.
Is z a matrix too? A more efficient way would be
dn <- dim(z)
new <- t(matrix(t(z), dn[2], dn[1]*n))
relying on recycling. As the t's show, it works most naturally for cbind.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._