Histograms of Data Frame Columns

FFA

New Member
#1
I have a data.frame that I need produce a histogram for each column of data. I'm using the dataframe baseball from the library coorgram here.

The second line of code removes all of the non numeric data from the data frame. My code currently produces the histogrm but incorrectly places all of the column names for each histogram name. I need each column name to be the main title of its corresponding histogram. I would also like to display all of the histograms simultaneously as a lattice.

library(corrgram)

baseb <- baseball[sapply(baseball, function(x) !is.factor(x))]

hbaseb <- sapply(baseb, function(x) hist(x, plot = TRUE, breaks = "Sturges", freq = FALSE, col = "blue1", main = paste("Histogram", colnames(baseb))))