I am a newbie at R, and have been trying to use the 'attitude' dataset to create histograms for each of the columns.
I can achieve this manually by typing out:
par(mfrow=c(1,7)) hist(attitude$rating) hist(attitude$complaints) hist(attitude$privileges) hist(attitude$learning) hist(attitude$raises) hist(attitude$critical) hist(attitude$advance)
However, what I'd like to do is use a single function to plot all the histograms, possibly using ggplot. This is the command I used after searching on Stackoverflow:
ggplot(attitude, aes(x=variable)) + geom_histogram()
but it seems I'm doing it wrong since I get this message:
Error in eval(expr, envir, enclos) : object 'variable' not found
I will appreciate any pointers in this regard. Thank you.