[R] extract rows of a matrix

Jonathan Christensen dzhonatan at gmail.com
Tue Oct 12 22:05:29 CEST 2010


Hannah,

a <- matrix(rnorm(10000),nrow=500)
new.matrix <- a[seq(0,dim(a)[1],by=20),]

Jonathan


On Tue, Oct 12, 2010 at 1:59 PM, li li <hannah.hlx at gmail.com> wrote:
> Hi all,
>  I want to extract every 20th row of a big matrix, say 10000 by 1000.
> What is the simper way to do this?
>   Thank you very much!
>            Hannah
>
>        [[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