s-news
[Top] [All Lists]

Re: Selecting every other line from a data frame

To: "'Khan, Sohail'" <khan@cshl.edu>, <s-news@lists.biostat.wustl.edu>
Subject: Re: Selecting every other line from a data frame
From: "Christos Hatzis" <christos@nuverabio.com>
Date: Fri, 21 Apr 2006 11:50:55 -0400
In-reply-to: <C8696843AE995F4EA4CDC3E2B83482A901879010@mailbox02.cshl.edu>
Organization: Nuvera Biosciences
Reply-to: <christos@nuverabio.com>
Thread-index: AcZlWqRkpU1wCVj4Qq6EZVOGlkb9rAAAIJvg
You can try the following:

my.df[ nrow(my.df) %% 2 == 0, ]

for selecting even lines or == 1 for odd lines.

-Christos 

-----Original Message-----
From: s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On Behalf Of Khan, Sohail
Sent: Friday, April 21, 2006 11:46 AM
To: s-news@lists.biostat.wustl.edu
Subject: [S] Selecting every other line from a data frame

Dear All,

I have a large data frame, from which I want to only select every other line
or odd lines.
How can I do this?  Thanks.


Sohail Khan
Scientific Programmer
COLD SPRING HARBOR LABORATORY
Genome Research Center
500 Sunnyside Boulevard
Woodbury, NY 11797
(516)422-4076

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with the
BODY of the message:  unsubscribe s-news




<Prev in Thread] Current Thread [Next in Thread>