RExcel and different versions of R

Using multiple versions of R with RExcel on the same machine is complex, but manageable.

If RExcel is configured to use the foreground server and is asked to start R, it will look for a running Rgui. If it finds one, it will try to connect to this version of R. If it does not find one, it will check the registry for the “current” version of R. It finds the path to this version in the registry in

HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath

This entry is set when R is installed (but only if the user checks the appropriate checkbox during the R installation or by running RSetReg.exe in the bin directory of the R installation. (modified sentence -gg)

Then RExcel tries to connect to the rcom server within that version of R. This only can work if this R process has run the command

library(rcom)

or

require(rcom)

before RExcel tries to connect to it, and if furthermore

library(rcom)
comRegisterRegistry()

has been run for this version of R and for no other version of R after that run.

When RExcel is installed, it adds some commands including library(rcom) to …..\etc\RProfile.site, therefore library(rcom) will be run whenever this version or R is started.

When later another version of R is installed, a few things have to be done.

  1. rcom and rscprooxy have to be installed in the new version.
  2. library(rcom) has to be added to the etc\RProfile.site for the new version
  3. comRegisterRegistry() has to be run for the new version
  4. bin\RSetReg.exe has to be run for the new version of R

Performing steps 3 and 4 for another version of R (for which steps 1 and 2 have been performed either by the user or as part of the installation of RExcel) then allows to switch the version of R which will be used by RExcel.

Starting a version of R from the command line or from an icon which is not the one for which RExcel is configured as described above cannot work because in that case RExcel tries to connect to the running R process, but the connection mechanism uses the information created by the last execution of comRegisterRegistry() which points to another version of R.

Up to version 3.0.8 the RExcel with RCommander icon (or the RExcel2007 with RCommander icon) started the version of R which was the current version of R at the time when RExcel was installed. Starting with RExcel 3.0.9 this icon start the version of R given by the registry entry HKEY_LOCAL_MACHINE\Software\R-core\R\InstallPath which might have been set when a new version of R was installed without reinstalling RExcel.


Personal Tools