[R] More complex historgram

Jim Lemon jim at bitwrit.com.au
Fri May 14 10:32:56 CEST 2010


On 05/14/2010 02:46 AM, Blue.Egg wrote:
>...
> I need to find out how can I on R, plot the mean egg of EGGS.H according to
> the district, or sex.
>
> Also how to compare the eggs of females on year of study x (in t.test)

Hi Blue.Egg,
You can always try barNest:

# first let's get more than one district
bluegg.df$DISTRICT<-factor(sample(c("PO","PQ"),25,TRUE))
barNest(EGGS.H~DISTRICT+SEX,data=bluegg.df,
  ylab="Mean number of eggs",
  barlabels=list("Overall",c("District PO","District PQ"),
  c("Male","Female")),main="Blue.Egg\'s breakdown of eggs",
  col=list("lightgray",c("green","orange"),c("pink","lightblue")))

and if you want nested bars, add showall=TRUE. For the t-test:

t.test(EGGS.H~SEX,bluegg.df)

Jim



More information about the R-help mailing list