s-news
[Top] [All Lists]

Re: Exclude rows. from a dataframe

To: "Sundar Dorai-Raj" <sundar.dorai-raj@pdf.com>
Subject: Re: Exclude rows. from a dataframe
From: <peter@archfunds.com>
Date: Thu, 30 Jun 2005 16:17:35 +0100
Cc: <s-news@lists.biostat.wustl.edu>
Thread-index: AcV9hoFN7t19F4sVTkWwCFZE9vgoqAAAC8ow
Thread-topic: [S] Exclude rows. from a dataframe
Perfect, I had something very similar but didn't pass syntax - this
works fine. Will give an example next time.
 
-----Original Message-----
From: Sundar Dorai-Raj [mailto:sundar.dorai-raj@pdf.com] 
Sent: 30 June 2005 16:13
To: Peter Leathers (peter@archfunds.com)
Cc: s-news@lists.biostat.wustl.edu
Subject: Re: [S] Exclude rows. from a dataframe



peter@archfunds.com wrote:
> Apologies if this is a dumb question, but have been searching and 
> experimenting for a while without success. I have a dataframe with
dates 
> and returns in it (2 columns) and want to create a new dataframe with 
> only positive returns in it.
> 
>  
> 
> Thanks in advance
> 
>  
> 
> Peter

(An example would be nice.)

Would the following work for you?

# assume `x' is your data.frame
# with `return' your column of returns
pos.x <- x[x$return > 0, ]

HTH,

--sundar

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