[R] Creating a new table from a set of constraints
    Francisco J. Bido 
    bido at mac.com
       
    Fri Aug 29 08:09:53 CEST 2003
    
    
  
Hi Everyone,
Here's a silly newbie question.  How do I remove unwanted rows from an 
R table?  Say that I read my data as:
X <- read.table("mydata.txt")
and say that there are columns for age and gender.  Call these X[5] and 
X[10], respectively.
Here, X[5]  is a column of positive integers and X[10] is binary valued 
i.e., zero (for male) and one (for female)
Now, say that I want to form a new table called Y which has the 
following constraints:
1.  Only females that are between 18 and 40 years old.
2.  Only males that are between 20 and 30 years old
I can do this using a typical procedural approach (no different than C 
programmer would) but it seems
to me that R has many shortcuts and so I thought I ask first before 
heading on an inefficient path. What's
a good way of doing this, my data set is very large?
Thanks,
-Francisco
    
    
More information about the R-help
mailing list