Review of “Building interactive graphs with ggplot2 and shiny”

August 4, 2014
By

(This article was first published on Mark van der Loo, and kindly contributed to R-bloggers)

Recently, Packt published a video course with the above title, and I've just spent a pleasant morning reviewing it on Packt's request. Pleasant, because I think the course gives an excellent introduction to both ggplot2 and shiny. The course is authored by Christophe Ladroue.

Course material

Both video and sound are of good quality, and Christophe's clearly pronounced English is easy to follow. I somtimes find that the speed of the course is a bit to high but it is easy to rewind and pause. All the scripts shown in the course come with the downloaded package, and I highly recommend people who follow the course run the examples and alter them.

Required knowledge

You need to be familiar with R. The course assumes you have some programming experience and if you've never written a function in R, you will need to brush up your R knowledge for the more advanced parts of the course.

Structure

The course is divided in 8 chapters, each consisting of 5 videos of about 2-3 minutes. It is set up in a top-down manner, starting (after some download-and-install instructions) with a quick intro to the grammar of graphics, after which a number of common visualizations are treated without lingering on details: default settings are used throughout to introduce line plots, paths, density plots and histograms and (multiple) boxplots. The course continues explaining how to create grouped plots (Ch. 3), add smoothers (Ch. 4), and then follows with details on how to tweak things like axes, scales and colors (Ch. 5). After this, chapters 6, 7 and 8 introduce shiny, reactive programming, and a more complex application.

Pros

One of the things that really adds value to the course is that Christophe points out some commonly made mistakes by (new) users of ggplot. Having someone explain to you the difference between setting point color as an aesthetic rather than a fixed color can be a real time-saver for beginners.

Many subjects are discussed using a task-based structure. Flipping axes, changing the order of bars in a bar chart: all such tasks are easily found by browsing the index. Also, the section on tweaking axes and colors includes a short discussion on the BigVis package for visualizing larger datasets.

Explanation of shiny is well-structured: first, the application is shown, next the essential parts of the code are explained. I find that the course does a good job in explaining fairly complex material (reactive programming, scopes) in a concise and clear way.

Cons

As said above, I sometimes feel that the course is a little fast. I had to rewind a number of times. Since it's a video course I don't really consider this a big issue.

The course could have included a bit more pointers on how to graphically analyze data. For example, when discussing density plots and histogram, it could have been emphasized that it is very important to play with bandwidth/binwidth. On the other hand: it is a course on ggplot2 and shiny and not on graphical data analyses.

The discussion on condense and bin of the BigVis package are a bit short. I needed to read their help files to really understand what they do.

A discussion on the formula interface in the facet_wrap and facet_grid will probably be helpful for users following the course.

Conclusion

Learning ggplot2 is not easier than learning base graphics. In fact, one may argue that the learning curve for ggplot2 is a bit steeper since you need to familiarize yourself with concepts of the grammar of graphics. The big plus is that ggplot2 makes a lot of things easy once you learn it: axes, scales and legends have really good defaults in ggplot2. Learning shiny is another step up for R programmers since you need to learn about reactive programming.

I find that this course introduces both tools well and in a practical manner. I recommend this course to anyone who has sufficient R experience (see above) and who seriously wants to get going with ggplot2 and shiny. After that, I'd still keep Hadley's book at hand as a reference.

To leave a comment for the author, please follow the link and comment on his blog: Mark van der Loo.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.