I’ve been wanting to try out the amazing Slidify package developed by Ramnath Vaidyanathan for a while. What it does is generate html slide shows directly from R, using R markdown. Turns out it was the perfect entertainment for someone down with a flu on a very hot summer weekend.
I followed the instructions described here, but ran into a few problems. Google-fu only gave me one closed discussion thread with someone else having the same problem, which was solved by upadting to R 2.15.2.
Since I was already on R 2.15.2, that wasn’t much help. But, as Ramnath mentioned in that thread, it’s mostly a problem with
install_github, and building it from source worked for me. So, if you have never built an R package from source (like I didn’t), this post will hopefully save you a few hours.
Step 0: My session info, just for reference
> sessionInfo() R version 2.15.2 (2012-10-26) Platform: x86_64-w64-mingw32/x64 (64-bit) locale:  LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252  LC_MONETARY=English_United States.1252 LC_NUMERIC=C  LC_TIME=English_United States.1252 attached base packages:  stats graphics grDevices utils datasets methods base other attached packages:  devtools_1.1 loaded via a namespace (and not attached):  digest_0.6.0 evaluate_0.4.2 httr_0.2 memoise_0.1 parallel_2.15.2 plyr_1.7.1  RCurl_1.95-3 stringr_0.6.1 tools_2.15.2 whisker_0.1 Library path is C:/Users/Thiago Silva/Documents/R/win-library/2.15
Step 1: Download and install Rtools
I grabbed it from here, Version 3.0, ran the executable, no hassle.
Step 2: Install devtools
At the R command prompt:
No hassle either.
Step 3: Install slidify from Github, using devtools
As suggested on Ramnath’s page, all smooth.
Step 4: Install slidifyLibraries
This is where the problems began. Using the recommended
install_github method gave me the following error:
> install_github("slidifyLibraries", "ramnathv") Installing github repo(s) slidifyLibraries/master from ramnathv Installing slidifyLibraries.zip from https://github.com/ramnathv/slidifyLibraries/archive/master.zip Installing slidifyLibraries "C:/PROGRA~1/R/R-215~1.2/bin/x64/R" --vanilla CMD build "C:\Users\Thiago \ Silva\AppData\Local\Temp\Rtmp8esQJH\slidifyLibraries-master" --no-manual --no-resave-data * checking for file 'C:\Users\Thiago Silva\AppData\Local\Temp\Rtmp8esQJH\slidifyLibraries-master/DESCRIPTION' ... OK * preparing 'slidifyLibraries': * checking DESCRIPTION meta-information ... OK * checking for LF line-endings in source and make files * checking for empty or unneeded directories * building 'slidifyLibraries_0.1.tar.gz' Warning in utils::tar(filepath, pkgname, compression = "gzip", compression_level = 9, : storing paths of more than 100 bytes is not portable: 'slidifyLibraries/inst/libraries/frameworks/landslide/themes/machinalis/fonts/OFLGoudyStMTT-Italic.ttf'
(I got a lot of these warnings, only showing first and last)
Warning in utils::tar(filepath, pkgname, compression = "gzip", compression_level = 9, : storing paths of more than 100 bytes is not portable: 'slidifyLibraries/inst/libraries/widgets/mathjax/jax/output/SVG/fonts/TeX/Typewriter/Regular/CombDiacritMarks.js' "C:/PROGRA~1/R/R-215~1.2/bin/x64/R" --vanilla CMD INSTALL \ "C:\Users\THIAGO~1\AppData\Local\Temp\Rtmp8esQJH/slidifyLibraries_0.1.tar.gz" \ --library="C:/Users/Thiago Silva/Documents/R/win-library/2.15" --with-keep.source Warning in max(which(block[1:100] > 0)) : no non-missing arguments to max; returning -Inf Warning in rawToChar(block[seq_len(ns)]) : NAs introduced by coercion Error in seq_len(ns) : argument must be coercible to non-negative integer Error: Command failed (1)
Step 5) Install slidifyLibraries from Windows command prompt
Since the above didn’t work, I took matters in my own hands. First, I built the package from source using
devtools. I downloaded it from Ramnath’s repository as a Zip file, then extracted it and removed the “-Master” from the main folder name (no idea if renaming matters or not, to be honest).
build("C:/Users/Thiago Silva/Downloads/slidifyLibraries/", binary=FALSE)
This gave me a file named “slidifyLibraries_0.1.tar.gz”. Once I had it, I opened a command prompt window, navigated to the folder where the file was, and typed:
R CMD INSTALL slidifyLibraries -l "C:\Users\Thiago Silva\Documents\R\win-library\2.15"
Don’t forget to change the path to your own R library path! The following happened:
R CMD INSTALL slidifyLibraries -l "C:\Users\Thiago Silva\Documents\R\win-library\2.15" * installing *source* package 'slidifyLibraries' ... ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded *** arch - i386 *** arch - x64 * DONE (slidifyLibraries)
And, voilá, it worked (for me). I now have my first slidify presentation. Success!
P.S.- If your Dropbox path is different from the standard installation (mine is),
publish() will throw an error:
> publish('testdeck3', host = 'dropbox')
Creating slide directory at ~/Dropbox/Public/testdeck3
Copying files to ~/Dropbox/Public/testdeck3
1: In file.copy(".", drop_dir, overwrite = F, recursive = TRUE) :
'recursive' will be ignored as 'to' is not a single existing directory
2: In file.create(to[okay]) :
cannot create file '~/Dropbox/Public/testdeck3', reason 'No such file or directory'
I fixed by creating a symbolic link to the actual Dropbox folder, inside my Documents folder, following these instructions (command-prompt option).