[R] extract a row

2004-08-16 Thread Randy Zelick
Hello there,

Using 1.9.0 on WinXP...

I have a data frame, one column of which is named rate. The column has
text entries like fast, medium, slow, very slow, and so forth. I
have not tried to make them factors, but maybe R did this automatically.

Anyway, I would like to display on the console rows that meet a rate
criterion.

So I want to type something like:

dataframe[rate==slow]

and get back this sort of output:

test  subject  trial  rate  score

 34B27  3 slow   27
 55B55  4 slow   34

where test, subject, trial, rate, and score are all the
dataframe's columns.

How do I do that??

Thanks,

=Randy=


R. Zelick   email: [EMAIL PROTECTED]
Department of Biology   voice: 503-725-3086
Portland State University   fax:   503-725-3888

mailing:
P.O. Box 751
Portland, OR 97207

shipping:
1719 SW 10th Ave, Room 246
Portland, OR 97201

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] extract a row

2004-08-16 Thread Adaikalavan Ramasamy
df[ df$rate==slow, ]


On Mon, 2004-08-16 at 18:48, Randy Zelick wrote:
 Hello there,
 
 Using 1.9.0 on WinXP...
 
 I have a data frame, one column of which is named rate. The column has
 text entries like fast, medium, slow, very slow, and so forth. I
 have not tried to make them factors, but maybe R did this automatically.
 
 Anyway, I would like to display on the console rows that meet a rate
 criterion.
 
 So I want to type something like:
 
 dataframe[rate==slow]
 
 and get back this sort of output:
 
 test  subject  trial  rate  score
 
  34B27  3 slow   27
  55B55  4 slow   34
 
 where test, subject, trial, rate, and score are all the
 dataframe's columns.
 
 How do I do that??
 
 Thanks,
 
 =Randy=
 
 
 R. Zelick email: [EMAIL PROTECTED]
 Department of Biology voice: 503-725-3086
 Portland State University fax:   503-725-3888
 
 mailing:
 P.O. Box 751
 Portland, OR 97207
 
 shipping:
 1719 SW 10th Ave, Room 246
 Portland, OR 97201
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] extract a row

2004-08-16 Thread Kevin Bartz
The easiest way to do that is

subset(dataframe, rate == slow).

Please let me know if you have any more questions.

Kevin

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Randy Zelick
Sent: Monday, August 16, 2004 10:49 AM
To: R list server posting
Subject: [R] extract a row

Hello there,

Using 1.9.0 on WinXP...

I have a data frame, one column of which is named rate. The column has
text entries like fast, medium, slow, very slow, and so forth. I
have not tried to make them factors, but maybe R did this automatically.

Anyway, I would like to display on the console rows that meet a rate
criterion.

So I want to type something like:

dataframe[rate==slow]

and get back this sort of output:

test  subject  trial  rate  score

 34B27  3 slow   27
 55B55  4 slow   34

where test, subject, trial, rate, and score are all the
dataframe's columns.

How do I do that??

Thanks,

=Randy=


R. Zelick   email: [EMAIL PROTECTED]
Department of Biology   voice: 503-725-3086
Portland State University   fax:   503-725-3888

mailing:
P.O. Box 751
Portland, OR 97207

shipping:
1719 SW 10th Ave, Room 246
Portland, OR 97201

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html