README.md 966 Bytes
Newer Older
Holger Brandl's avatar
Holger Brandl committed
1
spin.R - A shell-wrapper for knitr::spin
2 3 4
===


Holger Brandl's avatar
Holger Brandl committed
5 6
Installation
---
7

Holger Brandl's avatar
Holger Brandl committed
8
Download a local copy and add it to your path using
Holger Brandl's avatar
Holger Brandl committed
9
```
Holger Brandl's avatar
Holger Brandl committed
10
targetDirectory=~/bin
Holger Brandl's avatar
Holger Brandl committed
11
wget -P $targetDirectory --no-check-certificate https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin.R
Holger Brandl's avatar
Holger Brandl committed
12 13
chmod +x $targetDirectory/spin.R
export PATH=$targetDirectory:$PATH
Holger Brandl's avatar
Holger Brandl committed
14
```
15 16


Holger Brandl's avatar
Holger Brandl committed
17 18
Usage
---
19

Holger Brandl's avatar
Holger Brandl committed
20 21 22 23 24 25 26
To use it from a shell you can call spin.R directly with a script as argument.
```
spin.R MyScript.R
```
The report will be created in the current working directory. To learn about options just call `spin.R --help`

In case you want to spin snippets you can source a small bash function that wraps spin.R
27
```
Holger Brandl's avatar
Holger Brandl committed
28
source <(curl https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin_utils.sh 2>&1 2>/dev/null)
29
```
Holger Brandl's avatar
Holger Brandl committed
30 31
Now you can spin R snippets by piping them into `spinsnip`

32
```
Holger Brandl's avatar
Holger Brandl committed
33
echo "require(ggplot2); ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()" | spinsnip "my_report"
34 35 36 37 38
```