[R] how to add frequencies to barplot

Juliet Hannah juliet.hannah at gmail.com
Tue Nov 23 16:06:25 CET 2010


Also check out the following post:

http://permalink.gmane.org/gmane.comp.lang.r.general/210897

On Sat, Nov 20, 2010 at 4:32 PM, casperyc <casperyc at hotmail.co.uk> wrote:
>
> 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