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

improved documentation

parent 01a05bea
No related branches found
No related tags found
No related merge requests found
A tiny wrapper around knitr::spin to use it from the terminal spin.R: A shell-wrapper for knitr::spin
=== ===
Installation Installation
--- ---
Download it using Download a local copy and add it to your path using
``` ```
targetDirectory=~/bin targetDirectory=~/bin
wget -P $targetDirectory https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin.R wget -P $targetDirectory https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin.R
chmod +x $targetDirectory/spin.R chmod +x $targetDirectory/spin.R
export PATH=$targetDirectory:$PATH export PATH=$targetDirectory:$PATH
``` ```
and add it to your PATH if necessary.
To prepare a shell just source in the script which will simply define 2 bash functions.
```
source <(curl https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin_utils.sh 2>&1 2>/dev/null)
```
Usage Usage
--- ---
You can spin R scripts with 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
``` ```
spinr MyScript.R source <(curl https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin_utils.sh 2>&1 2>/dev/null)
``` ```
or rsnippets with Now you can spin R snippets by piping them into `spinsnip`
``` ```
echo "require(ggplot2); ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()" | spinsnip "my_report" echo "require(ggplot2); ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()" | spinsnip "my_report"
``` ```
......
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