[R] no doubt a dumb question, but..
John
jwdougherty at mcihispeed.net
Tue Nov 9 17:52:43 CET 2004
On Monday 08 November 2004 19:56, Dr. John R. Vokey wrote:
> Yes, I am a newbie at R, but it is not the complex commands in R that
> have me baffled, but simple data commands. For example, why does
>
> something like:
> > plot(Girth ~ Height)
>
> *not* work after a command that allegedly loads the data:
> > data(trees)
>
> with the error message:
>
> Error in eval(expr, envir, enclos) : Object "Girth" not found
>
> but does work after the command:
> > attach(trees)
>
I have wondered this myself, but one reason may be that more than one data
table can be loaded at a time. Quite often data tables will use the same
names for fields. It would inconvenient for instance, if you had two tables
loaded, say one for trees and one for melons with a field named "Girth", and
tried a plot(Girth ~ Height) command. So data() more or less accesses that
table, and attach explicit identifies the table of interest.
JWDougherty
More information about the R-help
mailing list