Awhile ago I ran into this post about Tufte style barcharts in R. I am currently working on a presentation that I thought would benefit from the minimal style charts offered so I thought I would spread the word with a shout-out and quick gist. Quite a few of the presentations that I have been a part of tend towards jamming as many facts and figures on whatever the medium is. Whether it means throwing a multi-chart type interactive graph on a dashboard, or a slide with multiple graphs, it was nice to have some more license to make it well formed in terms of design.
We are going to need some data, the example uses the psych package but I like to find fun tables online. It is getting warmer here so let’s look at some data around ice cream consumption. I found this lovely website with a somewhat badly formed table, but that is no problem with the rvest package. So let’s grab the table, oh and also load the packages we need.
Once loaded we need to sort out the weird list form it comes in with these two little bits of code. I have working knowledge of xpaths and front end development but my few minutes of poking around the page inspector and using the SelectorGadget I could not get it perfectly right. So the rapid prototyper in me just decided I had what I needed and could refine it later. What I mean is that if you will notice the way I have it the ice_table comes in as a list and the second item has our data we want (You can test this by typing: ice_table). So we just simply need to create a handy data frame of our ice_table.
Once we have our data frame we can plot it with the handy guide from the post I mentioned earlier that mimics Tufte minimal barcharts.