[R] Newbie question: histogram

Uwe Ligges ligges at statistik.uni-dortmund.de
Wed Feb 4 15:54:52 CET 2004


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.

I guess you are not going to create a histogram but a barplot as in:

barplot(mydata$snow.cover, mydata$year, names = mydata$year)

Uwe Ligges


> Many thanks.
> 
> PR
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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




More information about the R-help mailing list