# Using a different R version with RLink

I wish to use a different version of R than what is provided by Mathematica 9. For example, I want to use the Macports version of R, where R_HOME is /opt/local/lib/R.

When I type:

Needs["RLink"]
InstallR["RHomeLocation" -> "/opt/local/lib/R"]


I get the error:

InstallR::fail: Failed to install R.
The following error was encountered: Unable to load dynamic libraries >>


(I tried to doctor up my ~/.MacOSX/environment.plist with DYLD_LIBRARY_PATH, but no luck.)

• I'm also wondering if it is (will) be possible to update the internal R that gets downloaded from WRI to a later version (currently it's 2.14 while the latest R is 2.15). Once we install it using InstallR[]`, are we stuck with a particular version? – Szabolcs Nov 29 '12 at 3:23
• Originally I hoped that this option would work on all platforms. My initial tests indicated that it did. I had to then narrow this down to Windows for the time being, since problems on Linux and Mac were detected. This is a high-priority issue for RLink, so I hope to have more to say soon enough. – Leonid Shifrin Nov 29 '12 at 9:28
• @Szabolcs Yes, the users are stuck with that version until we update the paclets. But I hope that the option of using own version of R will be working on other (than Windows) platforms reasonably soon, which should mitigate this situation. – Leonid Shifrin Nov 29 '12 at 12:08
• For Linux folks: at least on some flavors of Linux, it has been reported that RLink works fine with the stand-alone R distribution. – Leonid Shifrin Nov 29 '12 at 17:45
• Take a look at the first code block under "Examples" here. This works on my OS X 10.8.3 machine with R 3.0.1, but I heard it does not work on all systems. I am using the CRAN version of R, not the MacPorts version (is there good reason to use the MacPorts version?). Does it work for you? – Szabolcs May 28 '13 at 20:43