Re: [Rd] Version names

From: Gabor Grothendieck <>
Date: Mon 29 Nov 2004 - 11:59:25 EST

Simon Urbanek <simon.urbanek <at>> writes:

: On Nov 28, 2004, at 11:58 PM, Gabor Grothendieck wrote:
: > Quite so but unfortunately if I want to produce a script
: > that has no dependencies then I need to use what is provided
: > in Windows and Windows batch commands seem to be the best
: > way to do that.
: Batch scripts are also quite dependent on the system and settings used.
: Moreover what are you trying to do? The rwXXX scheme is just a
: suggestion, every user is free to change the name during the
: installation, so there is no way to know by folder name which version
: you're dealing with... The only half-way sensible solution I can think
: of is looking for Rterm.exe and running each one to get the
: corresponding R version - I suppose you can do that with a batch script
: ;).

While what you say is true in the strict sense, batch scripts are usually small simple scripts that get the job done quickly.

In most cases I think its good enought that they work in non-pathalogical cases and that means searching for R in ., \Program Files\R\rw* and \R\rw* . This would be easy to do if the naming scheme were regular.

: If all you want to do is to determine the current (most recently
: installed) R version, then all it takes is two lines of C code [just
: read one registry entry] - and it's at least as portable across Windows

This just puts the problem one level off. Now we need to know where the C file is. The objective is to have a simple self contained script. It would be possible to do it all in C but then its not a script and its certainly not simple.

: systems as a batch script, but far more flexible. (There may even be a
: way to get that info w/o coding at all - I'm not sure whether regedit
: has any batch mode or something ...).

I don't think regedit has a batch mode. e.g. regedit /? does not give help. It would likely be possible to do it in vbscript and I may try that although I do think that that is leaving the realm of simplicity and it think it shoulnd be easier to write a simple batch script that finds R. I was putting off learning vbscript since I have never needed it and Microsoft is moving to Monad/MSH for scripting in Longhorn so I think vbscript may soon be orphaned. Also I was hoping that at some point the entire package building process will migrate to R and scripts including perl, batch, UNIX-like commands etc. will become unnecessary.

I quickly looked for the file where R sets the registry after reading your post but could not quickly find it. If anyone can provide the url to it in the svn repository or elsewhere that would helpful.

For the moment I have a viable workaround which is not to install any R version that would be out of sequence (e.g. don't install any beta or dev versions or if you do install a beta or dev version don't install another version until the pat or next version number comes out or delete the beta or dev version if you do). This allows me to work with simple scripts. These scripts do allow one to alternately specify the location of R explicitly through an environment variable or to simply cd to the rw folder so its always possible to force a certain version even in the absence of such a protool. mailing list Received on Mon Nov 29 12:05:46 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:01:50 EST