Skip to content

Instantly share code, notes, and snippets.

@daattali
Created February 1, 2015 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daattali/61636f4389cc91079977 to your computer and use it in GitHub Desktop.
Save daattali/61636f4389cc91079977 to your computer and use it in GitHub Desktop.
Add this at top of R script so that "source"ing the script will automatically render a markdown+HTML
#+ spinme-chunk, eval = FALSE, echo = FALSE
.scriptName <- basename(sys.frame(1)$ofile)
.spinOutput <- knitr::spin(.scriptName, knit = TRUE)
stop(sprintf("Ignore this error - your output is ready at:\n%s",
normalizePath(.spinOutput)),
call. = FALSE)
#+ spinme-done, eval = TRUE, echo = TRUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment