The author of the book titled Reproducible Research with R and RStudio , Christopher Gandrud, has made the code available on github. This code can be run to obtain a book that is identical to the one that is available in the stores(priced at $45). I have spent a few hours trying to run the code. Even though the directions are pretty straightforward, I had to make a few tweaks in order to recreate the content of the book. Here are the list of tweaks :

  • subfigure is used in many places and it is deprecated. Had to replace it with subcaption package which necessitates specifying the width for every subfigure
  • uncomment caption package
  • In chapter 6, I found that data from bit.ly addresses were not getting loaded via repmis and curl. Hence replaced it with the actual url’s.
  • In chapter 7, there is a bug in the code.
    • replace GatheredFert <- gather(SpreadFert, Year, Fert, 3:9) with GatheredFert <- gather(SpreadFert, Year, Fert, 3:6)
  • In chapter 7, there is a reference to FinRegulatorData but it isn’t loaded in the previous chapters. Hence had to tweak the code to load the dataset
  • Include FertData.RData in Chapter-7 folder and load the data in Chapter7.Rnw
  • In chapter 10, there is a typo for a specific image name. It should be GeoChartScreenshot.png instead of GeoChartScreenShot.png

Some of the above tweaks might be redundant as they could be specific to my system environment. In any case, as a result of all these tweaks I have managed to obtain the entire contents of the book for free.

Here is the link to the book : ./Source/Rep-Res-Parent.pdf