# rlink to a remote installation

I have a r installation on a server machine and have mathematica on my laptop. I have been using DatabaseLink to connect to the remote sql server and performing queries. I would now like to use mathematica on my machine to connect with r installation on the remote machine to pass codes from here and get results from the remote r installation. This is necessary as i don't have a lot of RAM on my machine. I know about RLink but can't find instruction to connect to a remote installation.

• Installing R using the Shared link suggested by Edmund works fine except it is not running R on the server but on the local machine. Is there a way to connect to R running on the server thereby using the resources of the server rather than the local machine. – user13892 Jun 8 '17 at 20:25

You may be able to use InstallR with the "RHomeLocation" option if you are on a Windows OS.

Needs["RLink"]
InstallR["RHomeLocation"->"\\\\servername\\sharename\\path to R_HOME of R Distrtribution"]


"RHomeLocation" works for local installations of R but I have not tried it for remote installations of R. There are a few more InstallR options that you should consider as well. Also have a read of the RLink User Guide as you may have to run RLinkResourcesInstall. It also gives information on how to optimise calls and data transfer between R and Mathematica.

Hope this helps.

• if you can guide me how to point to the remote server. In my remote desktop application i am able to access it with computer name tm46:10346 and the location of r installation on that system is C:\Program Files\R\R-3.2.4revised. How path exactly should i use? I tried before to import a file but the path never worked. – user13892 Jun 1 '17 at 11:40
• @user13892 You need to setup the folder as a shared folder on your network which will allow you to choose the name. Perhaps you should share the R directory so you can connect to different revisions. If you call the share RRevisions, then the command would be InstallR["RHomeLocation" -> "\\\\tm46:10346\\RRevisions\\R-3.2.4revised"]` – Edmund Jun 1 '17 at 13:15
• It is able to locate the folder now but still i am getting this error, InstallR::fail: Failed to install R. The following error was encountered: Unable to load dynamic libraries – user13892 Jun 2 '17 at 7:23
• Ok it is working fine now. But it is using the RAM of my local system in which i have mathematica rather than the server where the r resides. – user13892 Jun 6 '17 at 11:22