[rkward-devel] Using two versions of R with RKward

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Dec 30 20:00:50 UTC 2010


Hi,

On Thursday 30 December 2010, Horace Tso wrote:
> In Windows I regularly have multiple versions of R installed and do use for
> compatibility reason some older versions of R. That's easy since the Rgui
> is separate from the editor and I just double click on the older .exe.
> 
> On linux (ubuntu 10.04) rkward is blended in with R, so I wonder how it's
> possible to configure rkward to pick up another version of R.

basically, the situation is the same in each case: Just as with Rgui.exe, you 
need separate installations of RKWard to use separate installations of R (for 
a shortcut, see the end of this mail).

On Windows, your best bet is to copy the entire KDE-folder to a second 
location. Run the RKWard on Windows installer twice. This will ask you for the 
location of your KDE installation, and the location of R. Simply point one 
installation to one copy of KDE and the newer version of R, and the other to 
the second copy of KDE and the older version of R. Note: You will need to 
start [KDEFOLDER]\bin\rkward.bat in each case. Probably you want to create two 
separate shortcuts for the two installations.

On Linux, you will need to compile from source 
(http://p.sf.net/rkward/compiling). Use the
  -DR_EXECUTABLE
option to cmake to set up the correct version of R to use. Also you will need 
to install to separate locations. Use
  -DCMAKE_INSTALL_PREFIX
for that.

Note that on both Windows, and Linux, all installations of RKWard will share 
the same set of user settings (which is probably a good thing, though).

Now the shortcut: Actually, on Windows and on Linux, what you start is a shell 
/ batch wrapper around the real executable. Open /usr/bin/rkward or C:
\[KDEFOLDER]\bin\rkward.bat in a text editor. Edit the assignment of R_binary 
or R_BINARY, respectively, to point at your second installation of R. Save as 
a copy in the same directory (e.g. /usr/bin/rkward.alternative). Remember to 
set the executable bit on Linux. Finally, copy the "rkward" package from one 
version of R to the other (see below).

Note that this shortcut is not guaranteed to work at all times. It should work 
for all current versions of R (since R 2.9.x, IIRC), but sometimes changes 
happen in R that we can not cope with in a "binary compatible" way. So this 
shortcut may well break with the next release of R, without any advance 
notice.

> My second question is, how to "move" packages from one version of R to
> another. As under Windows, is it just a matter of copy and paste into
> \lib?

In theory, yes. Alternatively, use a common library location (see ?.libPaths 
or, in RKWard, Settings->Configure RKWard->R packages->R library locations), 
and install your packages there in the first place.

Note that there are reasons why R does *not* use a shared location by default, 
on any platform. Certain packages compiled with one version of R will not 
necessarily work (correctly) with a different version of R. The only safe bet 
is to use separate library locations, and to install the packages in each.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20101230/fcf8d186/attachment.sig>


More information about the Rkward-devel mailing list