How about foo <- c(1,2,3) bar <- matrix(rep(foo, 5), ncol = length(foo), byrow = TRUE)
>Date: 8 Jul 2003 15:58:25 +0200 >From: "David Andel" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >MIME-Version: 1.0 >Content-Transfer-Encoding: 8bit >X-Virus-Scanned: by amavisd-milter (http://amavis.org/) >X-Virus-Scanned: by amavisd-milter (http://amavis.org/) >X-Spam-Status: No, hits=-5.3 required=5.0 tests=BAYES_01, HAS_ORGANIZATION version=2.54 >X-Spam-Level: >X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) >Subject: [R] rbind question >X-BeenThere: [EMAIL PROTECTED] >X-Mailman-Version: 2.1.2 >List-Id: Main R Mailing List: Primary help <r-help.stat.math.ethz.ch> >List-Help: <mailto:[EMAIL PROTECTED]> >List-Post: <mailto:[EMAIL PROTECTED]> >List-Subscribe: <https://www.stat.math.ethz.ch/mailman/listinfo/r-help>, <mailto:[EMAIL PROTECTED]> >List-Archive: <https://www.stat.math.ethz.ch/pipermail/r-help> >List-Unsubscribe: <https://www.stat.math.ethz.ch/mailman/listinfo/r-help>, <mailto:[EMAIL PROTECTED]> > >Hi > >I am trying to replicate a vector in n rows for comparison purposes with >another matrix. > >foo <- c(1,2,3) >bar <- rbind(foo,foo) # does the trick for 2 rows >bar <- rbind(rep(foo,2)) # does something else > >How do I generate a matrix with all rows=foo without writing 'foo' n times as >arg? > >Thanks, >David > >______________________________________________ >[EMAIL PROTECTED] mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help Jianhua Zhang Department of Biostatistics Dana-Farber Cancer Institute 44 Binney Street Boston, MA 02115-6084 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help