I just finished reading the R Graphs Cookbook (2nd ed.), by Jaynal Abedin and Hrishi V. Mittal, edited by Packt Publishing.
Not to be confused with the R Graphics Cookbook, or its companion website, Cookbook for R.
This is a basic introductory text on R graphics. Beyond building basic graphics, such as scatterplot, bar chart, or histogram, the authors show how to customize various elements of a statistical graphic using R base graphics (axis limits, axis labels, legend, etc.) or how to arrange several plots in using custom layout. Special graphics for geostatistics and time series analysis are also discussed, even if the reader would have benefited from learning more from the use of dedicated packages, like
rgdal. Often times, this book looks much more like a list of recipes, organized by section, à la Mitchell’s Visual Guide to Stata Graphics (Stata Press, 2008), although I prefer how the latter is organized. Only two chapters are dedicated to the modern grid-based plotting libraries, namely lattice and ggplot2. However, there are excellent books that were written by Paul Murrell and Hadley Wickham for that purpose.
Clearly, this book is written for beginners in R, and it will certainly help those who feel afraid to review the Contributed documentation available on CRAN or find the ‘graphs’ and ‘advanced graphs’ sections of Quick-R too limited. The authors provide “How it works” and “There’s more” text boxes where they take time to explain how a given graphic was produced and where to look for further refinement or enhanced R functions. The book layout is concise and functional, and the text includes hyperlinks which greatly facilitate the reading.
Although the authors show how to export graph in PDF, for example, they say little about how to customize the final rendering even if we wait chapter 15 to get a more detailed version of what was already covered at the end of chapter 2. Since publishers are often very stringent regarding graphic pictures (dimensions, resolution, etc.), I would have expected more technical details on how to set up custom image format and how to select a font using modern packages, e.g., the
extrafont package. Likewise, the RColorBrewer package is used to define custom color palettes, but colourblind palettes are not even mentioned. Finally, the authors do not cover graphical representation specific of categorical variables in great details, although the vcd and vcdExtra packages offer lot of functionalities. There are few paragraphs that would benefit from being rearranged: Sometimes, base R functions are intermixed with calls to
lattice functions, which is unnecessary as there are two chapters for
ggplot2; likewise, 3D plots are covered in two different chapters, whereas we would expect to find them at the same place.