[ESS] Install experiences

Rodney Sparapani rsparapa at mcw.edu
Thu Jun 21 14:54:45 CEST 2012


On 06/21/2012 02:53 AM, Vitalie Spinu wrote:
>    >>  "Richard M. Heiberger"<rmh at temple.edu>
>    >>  on Wed, 20 Jun 2012 23:35:46 -0400 wrote:
>
>    >  ESS finds R automatically when it is put in the default location
>    >  c:/Program Files/R/
>
> I wonder if anyone investigated of how to make ESS search for R in
> windows registry. That would solve the issue once and forever.
>
> Vitalie.

Actually, Paul Johnson started the thread "Windows suggestion..."
where he looked at various alternatives to discovering Rterm from
the registry.  I tested the following on Windows XP (sorry, I don't
have access to a Windows 7 test machine).  I call it find-rterm.cmd
It's not elegant, but it seems to work.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: use environment variable R_HOME if defined
:: else current folder if bin\rterm.exe exists
:: else most current R as determined by registry entry
:: else error
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo off

if not defined R_HOME if exist bin\rtrem.exe set R_HOME=%CD%

if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hklm\software\R-core\R /v InstallPath 2^>NUL ^| findstr 
InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hkcu\software\R-core\R /v InstallPath 2^>NUL ^| findstr 
InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hkcr\software\R-core\R /v InstallPath 2^>NUL ^| findstr 
InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hku\software\R-core\R /v InstallPath 2^>NUL ^| findstr 
InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hkcc\software\R-core\R /v InstallPath 2^>NUL ^| findstr 
InstallPath'
   ) do set R_HOME=%%~b

if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hklm\software\wow6432Node\r-core\r /v InstallPath 2^>NUL
^| findstr InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hkcu\software\wow6432Node\r-core\r /v InstallPath 2^>NUL
^| findstr InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hkcr\software\wow6432Node\r-core\r /v InstallPath 2^>NUL
^| findstr InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hku\software\wow6432Node\r-core\r /v InstallPath 2^>NUL
^| findstr InstallPath'
   ) do set R_HOME=%%~b
if not defined R_HOME for /f "tokens=2*" %%a in (
  'reg query hkcc\software\wow6432Node\r-core\r /v InstallPath 2^>NUL
^| findstr InstallPath'
   ) do set R_HOME=%%~b

if defined R_HOME echo R_HOME=%R_HOME%

if not defined R_HOME echo "Error: Rterm.exe not found" & goto:eof



-- 
Rodney Sparapani, PhD  Center for Patient Care and Outcomes Research
Sr. Biostatistician               http://www.mcw.edu/pcor
4 wheels good, 2 wheels better!   Medical College of Wisconsin (MCW)
WWLD?:  What Would Lombardi Do?   Milwaukee, WI, USA



More information about the ESS-help mailing list