[R] Newbie question: histogram
John Fox
jfox at mcmaster.ca
Wed Feb 4 15:20:43 CET 2004
Dear Philippe,
I suppose that you want a histogram for snow.cover and not for year. There
are several ways to proceed; two are
hist(mydata$snow.cover)
and
attach(mydata)
hist(snow.cover)
More generally, it's a good idea to read the introductory manual that comes
with R (or a book that introduces R). See, in particular, the section on
lists and data frames in the Introduction to R.
I hope that this helps,
John
At 12:41 PM 2/4/2004 +0100, Philippe de Rochambeau wrote:
>Hello,
>
>how do you create a histogram with a data frame?
>
>year snow.cover
>1970 6.5
>1971 12.0
>1972 14.9
>1973 10.0
>1974 10.7
>1975 7.9
>...
>
>mydata=data.frame(year=c(1970,...),snow.cover=c(6.5,...))
>
>hist(mydata) does not work.
>
>Many thanks.
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
More information about the R-help
mailing list