Skip to content

Instantly share code, notes, and snippets.

View jennybc's full-sized avatar

Jennifer (Jenny) Bryan jennybc

View GitHub Profile
@jennybc
jennybc / broken.Rmd
Created September 2, 2016 20:51 — forked from gmbecker/broken.Rmd
DebuggingInRmd
We set up knitr so it doesn't catch errors, then set
`options(error=recover)` to set up R's debug-on-error machinery.
We have to do one additional thing, before the options call though:
trace the recover function with`sink(NULL)` to turn off the output
capturing so the R console is useful when the debugging framework
dumps us back into it. This has to happen before the options call
because that call grabs the `recover` object and stores it somewhere
so setting a trace on recover after the call won't affect the cached
version that gets called upon an error.
@jennybc
jennybc / Differ.R
Last active June 10, 2020 21:13 — forked from muschellij2/Differ.R
Get the Diff of 2 file solely with R functions
#rm(list=ls())
library(git2r)
library(plyr)
library(daff)
differ = function(file1, file2){
path <- tempfile(pattern="git2r-")
dir.create(path)
repo <- init(path)