Hello, Since I have to switch from Windows to the Mac OS (10.6.4, Intel mac), I have to find a new solution to call R from Matlab, since the R-(D)Com solution no longer works. I found Rserve and RJava and successfully installed them (after some googling to solve minor installation issues). I am now going through existing Java code projects like RSession and R to figure out how to issue the calling instructions from Matlab using its Java interface. In the meantime, I had 2 questions: a) I superficially understand the basic difference between Rserve and RJava (Rserve is a client-server interface while RJava is a JNI based solution) and that Rserve allows one to maintain multiple R sessions. I would be grateful if someone could expand on the advantages of JRI (RJava) over Rserve, if any. Also, in a single-user, single-computer (multi-core) scenario, is there any advantage to being able to call multiple R sessions ? b) I also came across the RMatlab project in OmegaHat. I didn't pursue it much because the description on the web page, though it appears quite powerful, also dates from 2004 or so. Also, I am afraid of Matlab MEX-file compilation issues. Would someone be able to give me a comparison of features/ease-of-use of RMatlab compared to RJava/Rserve. Thanks much, Suresh
Rserve, RJava, RMatlab
2 messages · Suresh Krishna
Hello, I am trying to see if I can get RMatlab from Omegahat (http://www.omegahat.org/RMatlab/) working on OS 10.6.4 to be able to call R from Matlab. I am following the instructions at: http://www.stanford.edu/~dgleich/notebook/2009/09/rmatlab_using_r_from_matlab.html I got to the point of running the ./configure script (see below) where the script complains that libR.so cannot be found. I searched my Mac for a libR.so file, but could not find it. I am using the latest OSX binary from CRAN, and I read in the R for Mac OS X FAQ that it is already compiled as a shared library. If there are likely to be non-trivial changes involved in trying to compile it for OSX, then probably doing it by myself is beyond my current ability, as is also probably already obvious. Seeking hints/guidance/advice... Very best and many thanks, Suresh --------------------------------------------------------------------------------------------- Suresh-iMac:RMatlab suresh$ ./configure checking for mex... /Applications/MATLAB_R2007B/bin/mex checking for sed... /usr/bin/sed There is no R shared library (libR.so), so you cannot run R within Matlab. You will only be able to start Matlab from within R If this is not what you want, reinstall R from source with the configuration option ./configure --enable-R-shlib If you have already compiled R as a shared library but this script has not been able to find it, set the environment variable R_SHARED_LIB_DIR to the name of the directory in which it is located and re-install this package Looking for mclmcr.h checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed configure: creating ./config.status config.status: creating inst/scripts/RMatlab.csh config.status: creating inst/scripts/RMatlab.sh config.status: creating src/Makefile Using the following settings Mex compiler: /Applications/MATLAB_R2007B/bin/mex Mex extension: mexmaci Mex linker flags: -Wl,-flat_namespace -undefined suppress -bundle R shared library directory: Installation directory: ********************************************************* To set the environment variables to run R from within Matlab or vice versa, source the relevant shell script into your shell before running Matlab or R Bourne or Bash shell: . /scripts/RMatlab.sh Csh or Tcsh shell: source /scripts/RMatlab.csh ********************************************************* Suresh-iMac:RMatlab suresh$