Dear Martin,

At 06:07 PM 2/4/2004 +0100, Martin Maechler wrote:
>>>>> "JohnF" == John Fox <[EMAIL PROTECTED]>
>>>>>     on Wed, 04 Feb 2004 09:20:43 -0500 writes:

    JohnF> Dear Philippe, I suppose that you want a histogram
    JohnF> for snow.cover and not for year. There are several
    JohnF> ways to proceed; two are

JohnF> hist(mydata$snow.cover)

JohnF> and

    JF> attach(mydata)
    JF> hist(snow.cover)

Actually, attaching data frames is a bit discouraged these days.
The modern R way for this (and more complicated situations) is

with(mydata, hist(snow.cover) )


Although I'm aware of (some of) the problems and possibly confusing situations that can arise from attaching a data frame, I believe that, especially for novice users, there's an advantage in doing so. In particular, although using with() is perhaps less ambiguous, it is necessary to repeat it for each command.


Regards,
 John

    JohnF> More generally, it's a good idea to read the
    JohnF> introductory manual that comes with R (or a book that
    JohnF> introduces R). See, in particular, the section on
    JohnF> lists and data frames in the Introduction to R.

definitely!

Martin

----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox

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

Reply via email to