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

cont, new spin wrapper

parent b83b9ef5
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
===
To prepare a shell source in the script
source <(curl https://dl.dropboxusercontent.com/u/113630701/datautils/bash/bioinfo_utils.sh 2>&1 2>/dev/null)
Installation
---
To use them just source them when needed.
Download it using
```
wget -P ~/bin https://raw.githubusercontent.com/holgerbrandl/datautils/master/R/spinr/spin.R
```
and add it to your PATH if necessary.
Use the issue tracker to suggest changes or to report problems
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)
```
Bash
===
Usage
---
LSF Cluster Utils:
You can spin R scripts with
```
source <(curl https://dl.dropboxusercontent.com/u/113630701/datautils/bash/lsf_utils.sh 2>&1 2>/dev/null)
spinr MyScript.R
```
Tools to simplify bio-dataprocessing in bash
or rsnippets with
```
echo "require(ggplot); ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()" | spinsnip "my_report" "
```
R
===
The R bits are split up into tools for
* general data handling
* plotting using ggplot2
* bioinformatics using various bioconductor packages
```
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/core_commons.R")
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/ggplot_commons.R")
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/bio/bioinfo_commons.R")
devtools::source_url("https://dl.dropboxusercontent.com/u/113630701/datautils/R/datatable_commons.R")
```
......@@ -2,16 +2,18 @@
spinr(){
## download if not yet there
if [ -z "$(which spin.R)" ]; then
wget -P ~/ https://raw.githubusercontent.com/holgerbrandl/themoviedbapi/v1.0/LICENCE.txt
>&2 echo "spin.R is not installed. See https://github.com/holgerbrandl/datautils/tree/master/R/spinr for details"
fi
~/spin.R $*
}
export -f spinr
spinsnip(){
if [ $# -lt 1 ]; then
>&2 echo "Usage: spinsnip <report name> [other args]*"
>&2 echo "The R snippet to be spinned will be read from standard input."
return
fi
......@@ -28,6 +30,7 @@ spinsnip(){
rm $tmpR
}
export -f spinsnip
## usage example
# echo '
......
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