I think you mean:
dataset[dataset$x > 0 & dataset$y < 0, ]
presuming "x" and "y" are columns in "dataset".
--sundar
Jonathan Dakin wrote:
dataset[x > 0 & y <0,]
selects all rows of the dataframe which satisfy.
Jonathan Dakin
-----Original Message-----
*From:* s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] *On Behalf Of *Liu Zhigang
*Sent:* 29 May 2006 10:36
*To:* s-news@lists.biostat.wustl.edu
*Subject:* [S] 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
|