How about trying a nested subset:

submydf = subset(subset(mydf, a > 1),b <= a)

Steve Miller

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sachin J
Sent: Monday, April 17, 2006 10:38 AM
To: R-help@stat.math.ethz.ch
Subject: [R] Subset dataframe based on condition

Hi,
   
  I am trying to extract subset of data from my original data frame based on
some condition. For example : (mydf -original data frame, submydf - subset
dada frame)
   
  >submydf = subset(mydf, a > 1 & b <= a), 
   
  here column a contains values ranging from 0.01 to 100000. I want to
extract only those matching condition 1 i.e a > . But when i execute this
command it is not giving me appropriate result. The subset df - submydf
contains rows with 0.01 also. Please help me to resolve this problem.
   
  Thanks in advance.
   
  Sachin

                
---------------------------------

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to