I'm wondering if the following is possible.
I have a survey with 100+ questions, all categorical, collected in 4 locations. All questions are labeled q1, q2 and so on. Let's say there are 100 for simplicity.
I can visually compare the results of a particular question across locations with:
library (lattice);
histogram(~ q75 | location, data = survey, layout=c(1,4));
or, with ggplot2,
library (ggplot2);
qplot(q75, data=survey) + facet_grid(location ~ .);
This gives 4 histograms, aligned vertically, for one question.
I'm wondering if there is a programmatic way to generate the histograms for all 100 questions, so left most I have the stack of 4 histograms for q1, then to the right the stack of 4 histograms for q2 and so on. Granted, it's going to be a long line, but this is for visual inspection only and for spotting the initial areas to investigate further. Scrolling to the right is fine with me, I have a wide-screen monitor so I'll get a decent number of histograms fitting in at one time.
That the questions are labeled with 'q' + a counter is good. What I don't know is
- how to make this kind of plot with lattice (or ggplot2?) it's a bi-dimensional lattice.
- how to feed such programmatically-generated field names into these commands.
Suggestions are appreciated. I'm a programmer, but not in R where I'm a newbie.