问题
I need to load a library every time I am making a new RConnection. Is it possible to have it pre-loaded when I start RServe?
Loading it every time a new RConnection is making it slower.
回答1:
Yes, you can use eval
or source
configuration options or --RS-source <file>
command line option. Anything you load this way is pre-loaded into the server before it starts listening for connections.
回答2:
It might not be working because you're missing the quotes around the library name. Another way to do it is to put the eval line inside /etc/Rserve.conf like this:
eval library('lib1'); library('lib2'); library('lib3')
回答3:
Finally after all the research I have found that RConnection only can be loaded with library, and every RConnection needs to be initialized with all the libraries and packages.
We just need to optimize the way we are using our RConnection.
来源:https://stackoverflow.com/questions/28634345/how-to-start-rserve-pre-loaded-with-library