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

changed to use wd for temporary files

parent 81a29965
No related branches found
No related tags found
No related merge requests found
......@@ -56,9 +56,15 @@ if(!file.exists(r_script)){
}
## postfix a default empty yaml header
## todo maybe we should rather run it in the script-home-dir to ensure that additional resources (e.g. pngs are picked up correctly)
tmpScript <- tempfile(fileext=".R", tmpdir=dirname(normalizePath(r_script)))
## Create a temporary script in the current working directory to ensure that created resources plots etc can be inlined
## To allow for additional resoucrces from the scripts directory to be inlined into the final documents, the directory
## of the script is exposed as a variable called RENDR_SCRIPT_DIR
## Note:## Using the script-home-dir as wd does not work because plot pngs would not make it into the final document. Also
## It's better to not clutter the directory containing the script since it might be under version control.
RENDR_SCRIPT_DIR=dirname(normalizePath(r_script))
tmpScript <- tempfile(fileext=".R", tmpdir=getwd())
print(paste("compiling tmp-script in ",tmpScript, "'"))
#tmpScript <- "tt.R"
......
R/rendr/test/inline_test.png

25.1 KiB

......@@ -17,3 +17,7 @@ datatable(iris)
## cd Desktop; export PATH=/Users/brandl/Dropbox/Public/datautils/R/rendr:$PATH
## rend.R -e /Users/brandl/Dropbox/Public/datautils/R/rendr/test/simple_report.R --fancy_arg 3 -E "foo bar"
## rend.R -E /Users/brandl/Dropbox/Public/datautils/R/rendr/test/simple_report.R
#' ![image inlineing failed](`r file.path(RENDR_SCRIPT_DIR, "inline_test.png")`)
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