Re: [R] barplot

About this list Date view Thread view Subject view Author view Attachment view

From: Achim Zeileis (zeileis@ci.tuwien.ac.at)
Date: Sun 12 May 2002 - 02:51:04 EST


Message-id: <3CDD4BF8.54A0D437@ci.tuwien.ac.at>

syed gillani wrote:
>
> Hi all,
>
> I have read in an epiinfo rec file with more than 100 variables and about
> 5500 rows. Among the variables are the following three: OB, a 0,1 coded
> variable indicating the presence of obesity, GEN, a 1,2 coded variable
> indicating gender and AGEGP, a variable with values ranging from 1 to 11,
> indicating agegroups.
> How could I make a barplot showing male and female obese persons by age
> groups?

I guess the simplest way is to first create a table with the information
you want, probably something like:
R> mytable <- xtabs(~ GEN + AGEGP, data = mydata, subset = OB == 1)
R> barplot(mytable)
If you code the variables as factors with proper labels then the labels
of the barplot will also be done automatically.
Z

> Thanks
> Basharat
> syed@saudionline.com.sa
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:16 EST