From ggrothendieck at gmail.com  Fri Jul 18 12:16:39 2008
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Fri, 18 Jul 2008 06:16:39 -0400
Subject: [Rd] Windows: adding R/bin folder to the PATH variable
In-Reply-To: <alpine.LFD.1.10.0807180911220.13340@gannet.stats.ox.ac.uk>
References: <F189E18BBAA8B6479F618B9044CF4E9C686C1337BB@owa.bfro.uni-lj.si>
	<alpine.LFD.1.10.0807180911220.13340@gannet.stats.ox.ac.uk>
Message-ID: <971536df0807180316n2431cff3racaaadfacefe4b9e@mail.gmail.com>

On Fri, Jul 18, 2008 at 4:18 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> On Fri, 18 Jul 2008, Gorjanc Gregor wrote:
>
>> Hi!
>>
>> Under Windows R is installed, but its bin folder is not added to the
>> system PATH variable. I know that this is handled properly under *nix like
>> systems and I wonder, why this is not the default also for the MS Windows? I
>> guess that for most users a shortcut on the desktop or anywhere else is
>> sufficient, but there are occasions when one expects to able to lunch R from
>> anywhere - say the Command prompt.
>
> This is the normal behaviour of Windows applications.  There are several
> reasons, including length limits on the Windows PATH (which are
> version-specific) and that shells are not normally used -- most Unix shells
> hash the path contents so lookup is (almost) independent of the number of
> applications on the path.
>
> If you run a shell (e.g. the Command prompt) you can set the path for that
> shell, and indeed I have my system setup to use a different path in shells
> than used from the desktop).
>
> Finally, those Windows installers that do add to the PATH frequently fail to
> uninstall correctly.
>

There are two other problems, as well:

- you might want to use two different versions of R on the same
computer

- the directory that normally resides at c:\rtools\bin contains a find
command which conflicts with the Windows find command so if
you keep rtools\bin in your path it can cause other Windows scripts
to fail.

At any rate, note that batchfiles at

http://batchfiles.googlecode.com

has Rcmd.bat, R.bat, Rgui.bat, etc. that you just place anywhere in your
path and they will automatically find R and rtools from the registry and
MiKTeX via a heuristic and then launch the corresponding R .exe .
Just place one of them or all of them anywhere in your path in which case
no path changes are required to run R or to build R packages at all.

They also have the advantage that if you use them you can be sure that the
temporary PATH that they set up and remove on the fly gets set properly which
is an advantage since, based on messages on r-help or r-devel, wrong setting of
PATH is a frequent problem.



[Rd] Windows: adding R/bin folder to the PATH variable
Gabor Grothendieck