Liu,
With data.frame named 'df' and columns named 'x' and 'y' use
df[df$x>0 & df$y<0, ] to select all columns with rows having
specified conditions.
DaveT.
**********************************************************
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
Sault Ste. Marie, Ontario, Canada
david.thompson@mnr.gov.on.ca
**********************************************************
-----Original Message-----
From: Liu Zhigang [mailto:email.lzg@gmail.com]
Sent: May 29, 2006 5:36 AM
To: s-news@lists.biostat.wustl.edu
Subject: a simple question--How to select subset of Dataframe in S-Plus
In SAS, I can use " if " to select my wanted observations.
For example, I want to select the obs satisfy the condition of x>0 and
y<0 (where x and y are variable in a dataset. )
and operate with this subset.In SAS I can do if use following
command:
[ If x>0 and y<0; ]
But who can tell me how to make this select in S_Plus.
Thank you!
Liu zhigang
Jilin University
|