[R] Population Histogram

Jim Lemon jim at bitwrit.com.au
Thu Dec 10 07:00:06 CET 2009


On 12/10/2009 04:39 PM, Jim Lemon wrote:
> 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
Oops, sorry, XLS files must be verboten, as the example data I sent 
seems to have disappeared.

Jim




More information about the R-help mailing list