[R] how to add frequencies to barplot

Greg Snow Greg.Snow at imail.org
Tue Nov 23 21:21:08 CET 2010


I would suggest reading the discussion (all the posts) starting at: http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22858.html

This gives reasons for not doing what you are asking along with some alternatives.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of casperyc
> Sent: Saturday, November 20, 2010 2:32 PM
> To: r-help at r-project.org
> Subject: [R] how to add frequencies to barplot
> 
> 
> Hi,
> 
> I have count data
> 
> x2=rep(c(0:3),c(13,80,60,27))
> 
> x2
>  0  1  2  3
> 13 80 60 27
> 
> I want to graph to be ploted as
> 
> barplot(table(x2),density=4)
> 
> how do I add relative frequency to it, like in
> 
> hist(x2,labels=T)
> 
> above the 'bar's
> 
> Thanks.
> 
> casper
> 
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/how-to-add-
> frequencies-to-barplot-tp3051923p3051923.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list