# NOT RUN {
d<-data.frame(x=c(1,5,10:20),y=runif(13)+1,
g=factor(sample(c("A","B","C"),13,replace=TRUE)))
# new plotH function with formula notation
plotH(y~x,data=d)
# old plot() function with formula notation -- for comparison's purpose
plot(y~x,data=d,type="h")
# new function over-riding default ylim, increasing bar width,
# and changing bar color
plotH(y~x,data=d,ylim=NULL,width=0.9,col="red")
# example of pass-through to barplot
smry<-by(d$y,d$g,mean)
plotH(levels(d$g),smry,ylab="Mean of Random Variable",xlab="Group")
# example of non-formula usage
x1 <- d$x
y1 <- d$y
plotH(x1,y1,col="blue")
# }
Run the code above in your browser using DataCamp Workspace