[R] barplot question

Jim Lemon jim at bitwrit.com.au
Wed Jul 20 13:27:30 CEST 2011


On 07/20/2011 01:24 AM, Sally_roman wrote:
> In my first post is example data.
>

Hi Sally,
I was going to suggest:

fish<-read.table("fish.dat",header=TRUE)
controlfish<-
  rbind(fish$pounds[fish$net=="Control" & fish$type == "kept"],
  fish$pounds[fish$net=="Control" & fish$type == "discard"])
expfish<-
  rbind(fish$pounds[fish$net=="Experimental" & fish$type == "kept"],
  NA,fish$pounds[fish$net=="Experimental" & fish$type == "discard"])
barplot(controlfish,xlim=c(0,8),width=0.5,space=1.2,offset=rep(-0.5,7)
barplot(expfish,width=0.5,space=1.2,add=TRUE)

but the "offset" argument seems to do nothing, so this doesn't work.

Jim



More information about the R-help mailing list