I have created some code to generate histograms using apply on the state.x77 dataset.
attach(as.data.frame(state.x77))
lapply(X=c("Population","Income","Illiteracy","Life Exp","Murder","HS Grad","Frost","Area"),FUN=function(s)hist(state.x77[,s],main=paste("Hist of",s)))
It works fine with generating the titles for the graphs but I do not know how to create labels for the x and y-axis.
The y-axis has the label "frequency" which is fine but I want to make it so that each x-axis is labelled according to the corresponding variable in state.x77.
How would I generate the labels?