Commit 5ecc6d47 authored by Holger Brandl's avatar Holger Brandl

inline rendr bash function

parent 6cf4cbc1
rendr(){
## test if present in PATH
if [ -z "$(which rendr.R)" ]; then
>&2 echo "rendr.R is not installed. See https://github.com/holgerbrandl/datautils/tree/master/R/rendr for details"
fi
rend.R $*
}
export -f rendr
rendr_snippet(){ rendr_snippet(){
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
>&2 echo "Usage: rendr_snippet <report name> [other args]*" >&2 echo "Usage: rendr_snippet <report name> [other args]*"
...@@ -17,6 +6,12 @@ rendr_snippet(){ ...@@ -17,6 +6,12 @@ rendr_snippet(){
return return
fi fi
## test if present in PATH
if [ -z "$(which rendr.R)" ]; then
>&2 echo "rendr.R is not installed. See https://github.com/holgerbrandl/datautils/tree/master/R/rendr for details"
fi
reportName=$1 reportName=$1
tmpR=$(mktemp -d)/$(echo $reportName | tr " " "_").R tmpR=$(mktemp -d)/$(echo $reportName | tr " " "_").R
...@@ -26,7 +21,7 @@ rendr_snippet(){ ...@@ -26,7 +21,7 @@ rendr_snippet(){
echo "rendering $tmpR..." echo "rendering $tmpR..."
shift shift
rendr -e $tmpR $* rend.R -e $tmpR $*
# rm -r $(dirname $tmpR) # rm -r $(dirname $tmpR)
rm ${tmpR} rm ${tmpR}
...@@ -38,4 +33,4 @@ export -f rendr_snippet ...@@ -38,4 +33,4 @@ export -f rendr_snippet
# > # test report # > # test report
# 1+1; # 1+1;
# ggplot(iris, aes(Sepal.Width) + geom_histogram() # ggplot(iris, aes(Sepal.Width) + geom_histogram()
# ' | spinsnip some_report # ' | rendr_snippet some_report
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment