[R] exteremely confused (simple question)

Chris Fonnesbeck fonnesbeck at gmail.com
Tue Oct 31 01:48:20 CET 2006


I thought I knew how to use data frames, but apparently not. I have
created a data frame, and named the columns:

> df
         K    Surv     Growth Class
1     4808 0.86212 0.00669640     S
2     2430 0.98038 1.30540000     S
3     2084 0.93579 0.44079000     S
4     2600 0.95394 2.03680000     S
5     2143 0.96112 1.78330000     S
6     4722 0.96682 6.36850000     S
7     2639 0.94464 0.81887000     S
8     4906 0.96520 3.10040000     S
9     1016 0.98993 1.69870000     S
10     973 0.98137 1.46750000     S
... etc.


However, when I try to index a subset of this data frame, I get an error:

> df[Growth<0.5]
Error in "[.data.frame"(df, Growth < 0.5) :
	object "Growth" not found

Why on earth is it looking for a "Growth" object, when it is a column
name in the data frame??

Extremely confused,
-- 
Chris Fonnesbeck + Atlanta, GA + http://trichech.us



More information about the R-help mailing list