Gary W <g.watmough <at> gmail.com> writes: > > > Hi ben > > Thanks for that, the density lines have now worked, however i was hoping > that the labels would be the names of the columns in my original data set > not numeric. any advice how to do this? > > gary w >
mapply(function(v,n) { hist(v,prob=TRUE,main=paste("Histogram of",n),xlab=n) lines(density(v),lwd=2) }, variables, variablenames) Or the loop equivalent. There are also slick ways of doing this with the lattice package (and getting a nice one-page layout of your graphs), if you "melt" your data frame first with the command from the reshape package. Ben Bolker ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.