This provides the KnitR code (and outputs) for a blog on UK voting (2015) and economic status (child poverty, income, pensions)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Who would vote for them?

This R markdown file (article.Rmd) provides text, hyperlinks and R code for producing the blog at titled: Who would vote for them?


The markdown file is intended to be processed by KnitR. To install type the following at your R commandline:


Other packages that are required are:

  • plyr
  • ggplot2
  • devtools
  • rCharts

For installation of rCharts, you are required first to install devtools and then to download rCharts from GitHub for installation. This can be performed using the following code at the R commandline (or in an R script):


# you then need to load the rCharts package before using it:

One final requirement is the data - the code will automatically collect the CSV file from FigShare. The download location is or the DOI link to the data description page is:


Having installed all the packages, it is simply a case of telling KnitR to process the Rmd file. KnitR can produce PDF, HTML or other formats. For HTML, the code is:


When complete, the folder containing article.Rmd will now also contain, article.html and a folder called 'figure' that contains html for each javascript figure and a PNG file for each static figure.

For uploading to my WordPress site I have manually copied and pasted the text, images and javascript into the various widgets I have installed for those things. There are ways to automatically upload to WordPress but I've not experimented with those yet.

NB: if viewing the webpage on your computer, you'll need to be running a webserver to see the javascript.


I recommend checking out the homepage for KnitR here:

Also the rCharts page here: