Skip to content

Instantly share code, notes, and snippets.

#' Turn a function into a new function that helps debugging upon exception
#'
#' @param fn the function to transform
#' @param saveFile an optional path to save RDS to, if NULL output will be in global variable '.problem'
#' @return new function that behaves like fn(...) normally, but if fn(...) throws an exception saves to variable or saveFile RDS of list .problem such that do.call(.problem$fn_name,.problem$args) repeats the call to fn with args.
#'
#' @examples
#' sum_of_log <- function(x, y){
#' stopifnot(x>=0)
@JJ
JJ / Submitting Rmd to Arxiv.md
Last active April 12, 2022 08:00
Submitting RMarkdown articles to Arxiv

Mini-HowTo submit RMarkdown articles to ArXiV

ArXiV is a place for publishing scientific technical reports and drafts which is tightly tied to LaTeX. That is why if you generate a PDF from your RMarkdown article it will tell you, hey, this has been generated using LaTeX, I want the LaTeX source. In principle, RStudio does not admit LaTeX as a final format, only .doc, .pdf or HTML. But it is no big deal.

You only need to add this to the metadata in the RMarkdown document

output: 
  pdf_document:
    keep_tex: true