Jason Bryer » R, and kindly contributed to Want to share your content on R-bloggers? [This article was first published on, and kindly contributed to R-bloggers ]. (You can report issue about the content on this page here Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I have become quite a big fan of graphics that combine the features of traditional figures (e.g. bar charts, histograms, etc.) with tables. That is, the combination of numerical results with a visual representation has been quite useful for exploring descriptive statistics. I have wrapped two of my favorites (build around ggplot2) and included them as part of my irutils R package (currently under development). Here is the code and results utilizing two item from the 2009 Programme of International Student Assessment (PISA).

library(devtools) install_github('irutils','jbryer') library(irutils) library(ggplot2) data(pisa) items29 = pisa[,substr(names(pisa), 1,5) == 'ST25Q'] names(items29) = c("Magazines", "Comic books", "Fiction", "Non-fiction books", "Newspapers") for(i in 1:ncol(items29)) { items29[,i] = factor(items29[,i], levels=1:5, labels=c('Never or almost never', 'A few times a year', 'About once a month', 'Several times a month', 'Several times a week'), ordered=TRUE) } plotHeatmapTable(items29) + opts(title="How often do you read these materials because you want to?")

items28 = pisa[,substr(names(pisa), 1,5) == 'ST24Q'] head(items28); ncol(items28) names(items28) = c("I read only if I have to.", "Reading is one of my favorite hobbies.", "I like talking about books with other people.", "I find it hard to finish books.", "I feel happy if I receive a book as a present.", "For me, reading is a waste of time.", "I enjoy going to a bookstore or a library.", "I read only to get information that I need.", "I cannot sit still and read for more than a few minutes.", "I like to express my opinions about books I have read.", "I like to exchange books with my friends") for(i in 1:ncol(items28)) { items28[,i] = factor(items28[,i], levels=1:4, labels=c('Strongly disagree', 'Disagree', 'Agree', 'Strongly Agree'), ordered=TRUE) } plotBarchartTable(items28, low.color='maroon', high.color='burlywood4') plotBarchartTable(items28, grouping=pisa$CNT, low.color='maroon', high.color='burlywood4')