[R] Graphics for proportion within factor

Jim Lemon jim at bitwrit.com.au
Mon Dec 1 10:53:54 CET 2008


Rob James wrote:
>   BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }I
> am looking to draw what I hoped was a simple plot of proportion WITHIN
> a strata, save % males by site. I seem to be able to get proportion of
> males, by
>  site, where the proportion is across the whole dataset, but not the
> proportion within each site.
>   
Hi Rob,
You might get what you want with the  barhier function in the plotrix 
package.
Try this:

test.df<-data.frame(Employ=sample(c("FT","PT","NO"),100,TRUE),
 Sex=sample(c("M","F"),100,TRUE))
library(plotrix)
barhier(test.df,col=c("red","green","blue"),fade=TRUE)

Jim



More information about the R-help mailing list