DeployR return svg from memory instead of storing it in a db

48 views Asked by At

I'm using DeployR server 8.0.5 as R API. I have R script deployed on that server which is using library : ggplot2. From what i know ggplot will store the plot on server only if i call

save(p, file = "plot.rdata") 

or

ggsave("plot.png", width = 5, height = 5) 

Looks like that print() function stores the svg into R database,here is an example how i'm generating SVG :

File_Name <- "MyPlot.svg"
myfile <- paste(File_Name)
svg(myfile,width=5, height=5, pointsize = 12)
print(My_Plot) #contains ggplot() result
dev.off()
result$plot <- myfile
return(result)

The problem is that the DeployR database is going huge. Looks like every response from DeployR is stored in db as byte[] in table : file_content .. i have a lot of request and respectively my DeployR database is going huge. One possible solution is to clear the db manually from time to time , but in general i want to change the behaviour . I don't understand why result is stored in database ? I just want to return the result , no need of storing the data.

So what i found is gridSVG library ,but i'm not sure how to use it in my case ,i'm not able to find proper example? Also find one more library : svglite , but again i'm not able to use it in my case.

0

There are 0 answers