Here are the two registry entries I’m asking about.**
HKEY_LOCAL_MACHINE\Software\R-core\R\Current Version
HKEY_LOCAL_MACHINE\Software\R-core\R\version\InstallPath
When R is launched from the command line (or from emacs, or statconnDCOM for that matter) it uses whatever version appears first in Windows’ Path environment variable. By contrast, double clicking on a *.Rdata file uses the version pointed to by the relevant file association entry in HKEY_CLASSES_ROOT.
But when or by what are the two HKEY_LOCAL_MACHINE entries used?
EDIT: Brian Diggs points to a bundle of Windows *.bat files that do use (and modify) these registry entries, but I’m still interested in whether anything closer to ‘core’ R uses these. (I’m hoping the answer is ‘no’.)
** As described in the R for Windows FAQ, these entries may be set either during installation (by clicking ‘Save version number in registry’) or later from the command line (by typing RSetReg.exe from within $RHOME\bin).
Major edit:
It looks like those registry entries are primarily there for use by external applications.
Here’s why I think that.
grep’ing
HKEY_LOCAL_MACHINEin the R sources turns up four hits in just three files. The files —"extra.c","RSetReg.c", and"rhome.c"— are all located inR-2.15.0/src/gnuwin/or its subdirectories.The relevant occurrence appears to be that in
R-2.15.0/src/gnuwin/rhome.c, where it is used by the C functionget_R_HOME. That function is designed toand it searches in the registry only if
R_HOMEif it has not yet been found in the “C environment space” or the “Windows API environment space”.get_R_HOME, in turn, only appears in two other files,"R-2.15.0/src/gnuwin/embeddedR.c", and"R-2.15.0/src/gnuwin/front-ends/rtest.c". (According to its residentreadmefile, the role of"R-2.15.0/src/gnuwin/front-ends/"is to make it possible to “Link[…] the R DLL into other applications”.)R’s *NIX origins and emphasis on portability make it seem unlikely that anything close to R’s core functionality would depend on registry entries. (This item’s obviously way more speculative.)
Unless I hear otherwise, that’s enough to convince me that the registry entries’ only purpose is to provide pointers for external applications, particularly those that use an embedded instance of R.