[R] Population Histogram

Jim Lemon jim at bitwrit.com.au
Thu Dec 10 06:39:30 CET 2009


On 12/10/2009 05:47 AM, terry johnson wrote:
> How would I make a population histogram in R from an excel file? Thanks
>    
Hi Terry,

library(gdata)
ozpop<-read.xls("ozpop.xls")
xycol<-color.gradient(c(0,0,0.5,1),c(0,0,0.5,1),c(1,1,0.5,1),18)
xxcol<-color.gradient(c(1,1,0.5,1),c(0.5,0.5,0.5,1),c(0.5,0.5,0.5,1),18)
library(plotrix)
par(mar=pyramid.plot(ozpop$Male,ozpop$Female,labels=ozpop$Age,
  main="Australian population pyramid 2002",xycol=xycol,xxcol=xxcol))

Jim



More information about the R-help mailing list