[R] select n rows

Patrick Burns pburns at pburns.seanet.com
Sat Mar 27 10:21:02 CET 2010


Your question is ambiguous -- at least
to me.  The posting guide:
http://www.r-project.org/posting-guide.html

suggests that examples can be helpful to
explain what you want.

 From the main statement I think the answer
might be:

mymatrix[seq(1, nrow(mymatrix), by=8), ]

 From the 'i.e.' clause I'm thinking:

mymatrix[1:8, ]

On 27/03/2010 06:20, leobon wrote:
>
> Hello everyone,
> I have a matrix with 8000 rows. If I want to select every 8 rows, (i.e.
> row1, row2, ..., row8), what should I do?
> Appriciate for any hints!
> Thanks a lot!
> Leo

-- 
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')



More information about the R-help mailing list