From 98f61c317f5e4980eb69e25638710e04ed6c040e Mon Sep 17 00:00:00 2001
From: Holger Brandl <brandl@mpi-cbg.de>
Date: Fri, 13 Feb 2015 10:48:07 +0100
Subject: [PATCH] added executable flag

---
 R/utils/spin.R | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 R/utils/spin.R

diff --git a/R/utils/spin.R b/R/utils/spin.R
new file mode 100644
index 0000000..0366166
--- /dev/null
+++ b/R/utils/spin.R
@@ -0,0 +1,32 @@
+## a thin wrapper around spin to make it more useful with more custom output
+
+require(plyr)
+require(knitr)
+require(stringr)
+
+options(width=150)
+
+#https://groups.google.com/forum/#!topic/knitr/ojcnq5Nm298
+
+## better table css: http://www.stat.ubc.ca/~jenny/STAT545A/topic10_tablesCSS.html
+spin(rScript, knit=F)
+
+mdScript <- str_replace(rScript, "[.]R$", ".Rmd")
+
+system(paste("mv", mdScript, "tmp.Rmd"))
+system(paste("cat tmp.Rmd | grep -Ev '^#+$' | grep -Fv '#!/usr/bin/env Rscript' >", basename(mdScript)))
+file.remove("tmp.Rmd")
+
+cssHeader='
+<style type="text/css">
+  body {
+      max-width: 90%;
+  }
+</style>
+'
+
+## custom title http://stackoverflow.com/questions/14124022/setting-html-meta-elements-with-knitr
+opts_chunk$set(cache = TRUE, fig.width=10, width=120)
+knit2html(basename(mdScript), header=cssHeader)
+
+file.remove(basename(mdScript))
-- 
GitLab