0

I wrote the following function to get the histogram for more than one variable, it works, but it doesn't display the header even though I have used the main argument.

lapply(c("avg_ed","api00","api99"), function(s){hist(mydata[s],main="Histogram of [s]")})

dataset used: http://www.math.montana.edu/~jimrc/classes/stat408/data/elemapi.csv

dj_stat
  • 35
  • 2
  • 4

1 Answers1

1
mydata <- read.table(file="elemapi.csv", header=TRUE, sep=",", na.strings=".")

lapply(X=c("avg_ed", "api00", "api99"), FUN=function(s)
  hist(mydata[, s], main=paste("Histogram of", s)))
Marco
  • 9,334
  • 7
  • 33
  • 51