Skip to content

Instantly share code, notes, and snippets.

@ramnathv
ramnathv / README.md
Created January 30, 2014 00:33
Creating PDF Version of Slidify Presentations

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.

@mrdwab
mrdwab / uReshape.R
Last active March 3, 2020 06:10
`reshape()` for "unbalanced" datasets.
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 = "_"))