[R] Newbie question: histogram

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 4 18:07:46 CET 2004

>>>>> "JohnF" == John Fox <jfox at mcmaster.ca>
>>>>>     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) )

    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.



More information about the R-help mailing list