Plotting tables alsongside charts in R
Occasionally I’d like to plot a table alongside a chart in R, e.g. to present summary statistics of the graph itself. Thanks to the
gridExtra package this is quite straightforward. The function
tableGrob creates a table like plot of a data frame, while
arrangeGrob allows me to arrange
grid graphical objects (short ‘grobs’, such as
tableGrob) on a page.
R version 3.2.1 (2015-06-18) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.4 (Yosemite) locale:  en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 attached base packages:  stats graphics grDevices utils datasets methods  base other attached packages:  gridExtra_2.0.0 ggplot2_1.0.1 loaded via a namespace (and not attached):  Rcpp_0.11.6 digest_0.6.8 MASS_7.3-42  grid_3.2.1 plyr_1.8.3 gtable_0.1.2  magrittr_1.5 scales_0.2.5 stringi_0.5-5  reshape2_1.4.1 proto_0.3-10 labeling_0.3  tools_3.2.1 stringr_1.0.0 munsell_0.4.2  colorspace_1.2-6