[R] Percentages in bar plot

PIKAL Petr petr.pikal at precheza.cz
Thu Jan 31 10:52:33 CET 2013


Hi

or use prop.table

barplot(prop.table(table(stop)))

Regards
Petr



> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Rui Barradas
> Sent: Wednesday, January 30, 2013 4:01 PM
> To: Naser Jamil
> Cc: R help
> Subject: Re: [R] Percentages in bar plot
> 
> Hello,
> 
> Try
> 
> barplot(table(stop)/sum(table(stop)))
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 
> Em 30-01-2013 11:34, Naser Jamil escreveu:
> > Dear R-users,
> > Though it's a silly thing to ask, but I'm not getting a way out. I
> > wish to find the percentage distribution for a data vector 'stop'.
> The
> > coomand below is giving the frequency distribution.  May I know the
> > option to see the percentages instead of frequencies.  Similarly,
> what
> > option I should put in a histogram plot to see the percentages
> instead of frequencies?
> >
> > ---------------------------------------------------------------------
> > stop<-c(8,6,6,6,8,6,6,8,8,6,6,6,8,8,8)
> > barplot(table(stop))
> >
> > --------------------------------------------------------------------
> >
> > Many thanks for your time.
> >
> >
> > Regards,
> > Jamil.
> >
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
> 
> ______________________________________________
> 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