diff --git a/R/spinr/README.md b/R/spinr/README.md index b1928429f50539cbdb9c3177b0777f0c041b890a..12dfa863f82a2ad09c27426c5aae3083750e95b6 100644 --- a/R/spinr/README.md +++ b/R/spinr/README.md @@ -1,32 +1,34 @@ -A tiny wrapper around knitr::spin to use it from the terminal +spin.R: A shell-wrapper for knitr::spin === Installation --- -Download it using +Download a local copy and add it to your path using ``` 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. -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 --- -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" ```