djun-kim edited this page Mar 22, 2013 · 7 revisions
Clone this wiki locally

Rserve provides a network server interface to the R statistical platform. Our RserveClient project provides a Perl client library to enable interaction with Rserve from Perl applications.

Using RserveClient, your Perl applications can pass strings to Rserve for evaluation by R. The results are returned as Perl objects.


The following code sets up a new connection to an Rserve server running on localhost, and sends to R the string x='Hello, world!'; x.

  use Statistics::RserveClient::Connection;

  my $cnx = new Statistics::RserveClient::Connection('localhost');
  my @result = $cnx->evalString("x='Hello, world!'; x");

The result (the last value returned by R in the computation) is returned in an array. Additional examples can be found in the Examples section.


This library is packaged as a CPAN module ([http://www.cpan.org/]). The easiest way to install it is to run the command

cpan install Statistics::RserveClient

or equivalent on the machine where you wish to install the library. Additional details can be found in the Installation section.


This software was partially funded through the financial assistance of the University of British Columbia, via a Teaching and Learning Enhancement Fund project led by Dr. Bruce Dunham (UBC Statistics).

The author would also like to thank Dr. Davor Cubranic (UBC Statistics) for many improvements to the code, in particular most of the tests.