I would use the subset() function. Assuming the data frame has variable
names "Gender" and "Age", you could do:
Y1 <- subset(X, Gender == 1 & Age >= 18 & Age <= 40)
Y2 <- subset(X, Gender == 0 & Age >= 20 & Age <= 30)
-roger
Francisco J. Bido wrote:
Hi Everyone,
Here's a silly newbie question
-
From: Francisco J. Bido [mailto:[EMAIL PROTECTED]
Sent: Friday, 29 August 2003 4:10 PM
To: [EMAIL PROTECTED]
Subject: [R] Creating a new table from a set of constraints
Hi Everyone,
Here's a silly newbie question. How do I remove unwanted rows from an
R table? Say that I read my data
ssage-
> From: Francisco J. Bido [mailto:[EMAIL PROTECTED]
> Sent: Friday, 29 August 2003 4:10 PM
> To: [EMAIL PROTECTED]
> Subject: [R] Creating a new table from a set of constraints
>
>
> Hi Everyone,
>
> Here's a silly newbie question. How do I remove unw
egant,
Good luck,
Arnaud
-Original Message-
From: Francisco J. Bido [mailto:[EMAIL PROTECTED]
Sent: Friday, 29 August 2003 4:10 PM
To: [EMAIL PROTECTED]
Subject: [R] Creating a new table from a set of constraints
Hi Everyone,
Here's a silly newbie question. How do I remove unwanted row
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