[R] replace a row in a matrix

John Kane jrkrideau at yahoo.ca
Sun Nov 14 17:10:48 CET 2010


Indexing

(xx <- matrix(1:4, nrow=2))
vec <- 5:6

xx[2,] <- vec
xx




--- On Sun, 11/14/10, cassie jones <cassiejones26 at gmail.com> wrote:

> From: cassie jones <cassiejones26 at gmail.com>
> Subject: [R] replace a row in a matrix
> To: r-help at r-project.org
> Received: Sunday, November 14, 2010, 10:59 AM
> Dear all,
> 
> 
> I created a n*2 matrix and I want to replace the ith row
> with a vector. Can
> anyone suggest me what is the simple way to do it? Sorry
> for bothering you
> with such  simple question. I appreciate any hints or
> advice.
> 
> 
> Thanks in advance.
> 
> Cassie
> 
>     [[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.
> 





More information about the R-help mailing list