Skip to content
Snippets Groups Projects
Commit adb3f354 authored by Holger Brandl's avatar Holger Brandl
Browse files

added executable flag

parent 3d2736c5
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,10 @@ Installation
Download it using
```
wget -P ~/bin https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin.R
targetDirectory=~/bin
wget -P $targetDirectory https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin.R
chmod +x $targetDirectory/spin.R
export PATH=$targetDirectory:$PATH
```
and add it to your PATH if necessary.
......
spinr(){
## download if not yet there
## test if present in PATH
if [ -z "$(which spin.R)" ]; then
>&2 echo "spin.R is not installed. See https://github.com/holgerbrandl/datautils/tree/master/R/spinr for details"
fi
chmod +x
~/spin.R $*
spin.R $*
}
export -f spinr
......
## 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))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment