s-news
[Top] [All Lists]

Re: a simple question--How to select subset of Dataframe in S-Plus

To: "'Liu Zhigang'" <email.lzg@gmail.com>, <s-news@lists.biostat.wustl.edu>
Subject: Re: a simple question--How to select subset of Dataframe in S-Plus
From: "Jonathan Dakin" <jdakin@overwey.demon.co.uk>
Date: Mon, 29 May 2006 12:49:41 +0100
Importance: Normal
In-reply-to: <551c2c780605290235n1a9d5673l3a17bc2aa4fc898a@mail.gmail.com>
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
<Prev in Thread] Current Thread [Next in Thread>