Skip to content
Prev 12124 / 63424 Next

Cygwin and Rtools (Was: RE: [Rd] cygwin tar?)

If it helps anyone, below is the startup script I use in WinXP to get
an MSDOS prompt that give me access to R and Ripley's Rtools so that I
can run RCMD build etc without problems and at the same time keep my
Cygwin installation. This is pretty much what Ripley suggest. Note the
"NOTE: ..." below!

I'm sorry if mine or your email client cuts the lines. 

Henrik Bengtsson

-------------------------------------------------------------
Begin: RCMDprompt.bat
-------------------------------------------------------------
@echo off
rem
######################################################################
rem # Usage: RCMDprompt.bat [path]
rem #
rem # This script opens a MS-DOS prompt with a enviroment variables
rem # set such that R can be ran and packages can be build. 
rem # If 'path' is given, the working directory will be set
accordingly.
rem # 
rem # NOTE: This scripts works even if Cygwin is installed. HOWEVER,
you
rem # can not have any Cygwin applications running (not even a shell
or
rem # XEmacs for Cygwin) at the same time you try to run RCMD.
rem #
rem # Requires:
rem # To build and install packages two things must be installed, i.e.
rem # exists in the PATH. First, the Rtools compilation [1] by B.
Ripley 
rem # must exists. The path (R_TOOLS) to it is set below. Second, Perl

rem # (must not be Cygwin/Perl) must also exists. The path to it is
set
rem # below.
rem #
rem # Reference:
rem #  [1] http://www.stats.ox.ac.uk/pub/Rtools/
rem #
rem # Henrik Bengtsson, hb@maths.lth.se, March 2004.
rem
######################################################################

rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # 1. "Global" environment variables
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # Short version of PROGRAMFILES, e.g. 'C:\Progra~1' instead of
rem # 'C:\Program Files\', which contains spaces that are BAD for R &
Co.
set PROGRAMFILES_SHORT=C:\Progra~1

rem # Directory where user directories are
set USERSDIR=C:\users

rem # Set the main R directory
set R_ROOT=%PROGRAMFILES_SHORT%\R

rem # Set the R_HOME directory
set R_HOME=%R_ROOT%\rw1081
rem set R_HOME=%R_ROOT%\rw1090alpha

rem # Set the HOME directory. This is the directory where R looks 
rem # for the .Rprofile and .Renviron files. See ?Startup.
set HOME=%USERSDIR%\%USERNAME%\

rem # Set TMPDIR to a temporary directory
set TMPDIR=%TEMP%


rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # 2. Setup the PATH
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # Clear the PATH (making the main Cygwin installation "invisible")
path ;

rem # Set the LaTeX directory
rem # http://www.miktex.org/
path %PROGRAMFILES%\MikTeX\miktex\bin;%PATH%

rem # Set the Microsoft HTML Help Compiler directory
rem #
http://msdn.microsoft.com/library/tools/htmlhelp/chm/HH1Start.htm
path %PROGRAMFILES%\HTML Help Workshop;%PATH%

rem # Set the Perl directory
rem # http://www.activestate.com/Products/ActivePerl/Download.html
path C:\Perl\bin;%PATH%
 
rem # Set the Rtools [1] directory
rem # http://www.stats.ox.ac.uk/pub/Rtools/
path %R_ROOT%\Rtools;%PATH%

rem # Set the R_HOME directory
path %R_HOME%\bin;%PATH%


rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # 3. Start the MSDOS prompt in the given directory
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - 
rem # Change directory according to argument 1
cd %1%

rem # Start the MSDOS commando prompt
%SystemRoot%\system32\cmd.exe

-------------------------------------------------------------
End: RCMDprompt.bat
-------------------------------------------------------------
cygwin1.dll.
with
can't