summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashantsinalkar2019-07-05 18:11:09 +0530
committerprashantsinalkar2019-07-05 18:11:09 +0530
commitcf4f98aa562af951f539a74df47ef332c9186744 (patch)
tree26ebfe0124e6cd24fed5e6e90a737be715d405f8
parent70b9ea3f66a7256695ba669cac8d59b515915832 (diff)
downloadR_on_Cloud_Web_API-cf4f98aa562af951f539a74df47ef332c9186744.tar.gz
R_on_Cloud_Web_API-cf4f98aa562af951f539a74df47ef332c9186744.tar.bz2
R_on_Cloud_Web_API-cf4f98aa562af951f539a74df47ef332c9186744.zip
added save path for plot
-rw-r--r--plumber.R5
1 files changed, 4 insertions, 1 deletions
diff --git a/plumber.R b/plumber.R
index 0226024..39c6ca4 100644
--- a/plumber.R
+++ b/plumber.R
@@ -32,7 +32,10 @@ function(code="", session_id="")
OutputFile <- paste("/tmp/",session_id,"/",session_id,".txt", sep="")
RunInputFile <- paste("Rscript", InputFile, sep=" ")
fileConn<-file(InputFile)
- writeLines(code, fileConn)
+ Line1 = paste("png('/tmp/",session_id,".png')\n", sep="")
+ Line2 = code
+ Line3 = "while (!is.null(dev.list())) dev.off()"
+ writeLines(c(Line1, Line2, Line3), fileConn)
close(fileConn)
#ro <- system(RunInputFile, intern = TRUE)
ro <-robust.system(RunInputFile)