This gist consists of a makefile and a script that can automate the creation of PDFs from Slidify generated HTML slides. The script assumes that the makefile and the script makepdf.js are in the same directory as the Rmd file. The makepdf.js script uses casperjs, a very useful utility to automate tasks that require browser interaction. You may follow the installation instructions on the casperjs website, to make sure that you have all the dependencies correctly installed before trying this out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uReshape <- function(data, id.vars, var.stubs, sep) { | |
| # vectorized version of grep | |
| vGrep <- Vectorize(grep, "pattern", SIMPLIFY = FALSE) | |
| # Isolate the columns starting with the var.stubs | |
| temp <- names(data)[names(data) %in% unlist(vGrep(var.stubs, names(data), value = TRUE))] | |
| # Split the vector and reasemble into a data.frame | |
| x <- do.call(rbind.data.frame, strsplit(temp, split = sep)) | |
| names(x) <- c("VAR", paste(".time", 1:(length(x)-1), sep = "_")) |