What is Rserve? |
| Rserve is a TCP/IP server which allows other programs to use facilities of R (see www.r-project.org) from various languages without the need to initialize R or link against R library. Every connection has a separate workspace and working directory. Client-side implementations are available for popular languages such as C/C++ and Java. Rserve supports remote connection, authentication and file transfer. Typical use is to integrate R backend for computation of statstical models, plots etc. in other applications.
The following Java code illustrates the easy integration of Rserve:
Rconnection c = new Rconnection();
double d[]=c.eval("rnorm(10)").asDoubleArray();
d now contains 10 random samples from the N(0,1) distribution if there is a runing Rserve on the local machine. The Rconnection doesn't have to be created more than once in your application.
As a side note - if you are looking just for a way to access R from Java in one application without the need for the client/server concept, you may want to have a look at JRI. It uses JNI to link R directly into Java.
|
What's new? |
| 2006/11/15 Rserve is now available as a package from CRAN. This also implies that the latest binary versions (both for Windows and Mac OS X) are now available form CRAN. Simply use install.packages("Rserve"). |
| 2006/10/12 Binary for R 2.4.0 on Mac OS X is now provided via an installation script (see download section) |
| 2006/10/10 Updated Windows binary for R 2.4.0 based on Rserve 0.4-3 |
| 2006/05/03 Rserve_0.4-3 released including Windows binary for R 2.3.0. The new 0.4 series supports sessions, i.e. the client can detach from the server and attach to the same session later on (e.g. when the computation has finished). The corresponding new client is now available for download. Also the C++ client has been extended to support authentication and file transfer. |
| 2006/01/31 Updated Windows binary for R 2.2.1 based on Rserve 0.4-0 |
| 2005/10/13 Updated Windows binary for R 2.2.0. The current development branch of Rserve is now 0.4 which supports the concept of sessions and can be found on the nightly build page. It is not the official release, because the sessions are not well tested yet. |
| 2005/07/27 Rserve_0.3-17 released with minor fixes for R 2.1.1 (mainly Windows-related) and corresponding Windows binary. |
| 2005/05/02 Updated Windows binary for R 2.1.0. |
| 2005/01/12 Rserve_0.3-16 released. It allows custom initialization such that you can pre-load data and libraries, allowing even faster responses for specific tasks. |
| 2003/10/08 Rserve_0.3-0 and updated Java client released (clients update necessary). Updated FAQ. Updated Windows binary. This version adds support for large data - if you experienced crashes while fetching large data in 0.2 and earlier, use this version instead. |
Features of Rserve |
|
- fast - no initialization of R is necessary
- binary transport - the transport protocol sends R objects as binary data, not just R text output.
- automatic type conversion - most R data types are converted into native data types, e.g. the result of rnorm(10) will be double[10] in C/Java. Java client also provides classes for new R types such as RBool, RList etc.
- persistent - each connection has its own namespace and working directory. Every object you create is persistent until the connection is closed. The client doesn't have to fetch or store intermediate results.
- client independence - since the client is not linked to R there are no threading issues like in RSJava etc.
- security - Rserve provides some basic security by supporting encrypted user/password authentication with server challenge. Rserve can be also configured to accept local connections only.
- file transfer - the Rserve protocol allows to transfer files between the client and the server. This way Rserve can be used as a remote server even for task such as generating plot images etc.
- configurable - one configuration file is used to control settings and to enable/disable features such as authorization, remote access or file transfer.
|
What Rserve is NOT |
| -
Rserve provides no callback functionality. Your application could implement callbacks via TCP/IP and the R sockets but it is not a part of Rserve.
- Rserve is not a telnet frontend to R. The printed output is not transported. Rserve uses binary protocol for transport of objects for better speed.
- Rserve is thread safe across connections, but eval methods are not thread safe within one connection. This means that multiple threads should not use the same connection unless they guarantee that no eval calls are run in parallel.
|