Skip to content
Prev 277360 / 398506 Next

Upgrade R?

Hello all,

	I received many emails to my post on this issue. None of the answers
were able to resolve all the issues experienced by many but helped me to
understand the issues. . But cons?der?ng the ava?lable OSs to install on,
many packages to install, and the fact that R is a product of open source
effort, it is still impressive that it works. The desirable solution surely,
is to have a mnu entry in R GUI to update the whole while managing library
packages with a dialog.  

	The problem Kevin and I had in removing the old R version 2.13.1 is
not solved. We had to delete the old version and remove the registry entries
manually since the Window's uninstall program gives an error using the
available uninstall.dat file and does not uninstall it. 

	In order to help others in similar issues, I gathered all the
responses I received on this issue (thankfully from Kevin Burton, Bert
Gunter, Uwe Ligges, Eric  Neuwirth, Richard M. Heiberger, David Wolfskill,
R. Michael Weylandt and Thomas Baier) and compiled them below. I hope, the
experts, in the light of these issues, would update the R-Manuals/Online
help etc. for successful updates.   

Updating to the new version of R:

There are basically two strategies for R upgrading on windows. 

A) The first is to install a new R version and copy paste all the packages
to the new R installation folder.

     The following methods explain different ways to achieve this.
 
1. Run the following script in R-Console:

	>update.packages(checkBuilt=TRUE)

	This will update all the user installed packages to new version. But
it will overwrite the old versions of the packages.

	Ref:
http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window


2. First you install the new version, then run this in the old version:

	#--run in the old version of R
	setwd("C:/Temp/")
	packages <- installed.packages()[,"Package"]
	save(packages, file="Rpackages")

	Followed by this in the new version:

	#--run in the new version
	setwd("C:/Temp/")
	load("Rpackages")
	for (p in setdiff(packages, installed.packages()[,"Package"]))
	install.packages(p)

	Ref:
http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-ver
sion-of-r
	
3. Run the following command on R-console:

	>rownames(installed.packages())
	
	This will tell you the names of all packages of the version of R in
which you are running the command.
	Then compare this list with the list given at
http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Add_002dOn-Packages . 
	The installed package differences between these two lists are the
user installed packages. 

4. The "Other" section on CRAN has an item called "batch files".

	In there is copydir.bat which allows you to copy packages from one
version of R to another version.
	It will respect already installed packages in the destination
directory and not overwrite them with possibly older versions.

	Ref: http://cran.r-project.org/ . Download batchfiles_0.6-6.zip from
there.
	
5. If you want to install packages from SourceForge without overwriting them
from CRAN:

	Ref:
http://stackoverflow.com/questions/3971815/automagically-update-packages-ins
talled-from-r-forge 

6. If you also have statconnDCOM (rcom) installed, here are the recommend
steps:
	
	a. Install the latest version of R
	
    b. Copy your installed packages from the old version of R to the new
version of R.
	
		copydir "c:\Program Files\R\R-2.3.1\library" "c:\Program
Files\R\R-2.14.0\library"
	
    c. Start R with the -vanilla command line option:
	
		"C:\Program files\R\R-2.14.0\bin\Rgui.exe" --vanilla
		
    d. Update the packages:
	
		update.packages(checkBuilt=TRUE, ask=FALSE)
		
    e. Configure R with the latest version of rcom:

		library(rcom)
		comRegisterRegistry()

	Ref:
http://learnserver.csd.univie.ac.at/rcomwiki/doku.php?id=wiki:how_to_upgrade
_r_with_our_packages_installed
	         Running comRegsterRegistry() gives NULL. Then the
application using statConn works fine.
		
B) The second is to have a global R package folder, each time synced to the
most current R installation (thus saving us the time of copying the package
library each we upgrade R)."How to upgrade R on windows XP - another
strategy" which explains how to upgrade R using the simple two-liner
codesource:

	
source("http://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-o
n-windows.r.txt")
	New.R.RunMe()
	
	p.s: If this is the first time you are upgrading R using this
method, then first run the following two lines on your old R installation
(before running the above code in the new R intallation):

	
source("http://www.r-statistics.com/wp-content/uploads/2010/04/upgrading-R-o
n-windows.r.txt")
	Old.R.RunMe()
	
	Ref:
http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-t
he-r-code-to-do-it-on-windows/ 	 
	
http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/

                        This  update leaves two library directories one in
the "C:\Program Files\R\library" directory and the other in the "C:\Program
Files\R\R-2.14.0\library" directory. Deleting the second makes R console
confused since it cannot find even the basic library. But undeleting it, is
extra ~0.5GB space.
		 
Uninstalling the old version of R:

	After all the packages are updated and the depended ones such as
rcom were registered, the old version can be uninstalled through "Programs
and Features" option of Windows. 
	
Problems with installing the new version and uninstalling the old version: 

	There are many problems reported. Here are a few:
	
1. Windows 7 issues:

	Windows security, UAC, installation directories etc. See:

	Ref:
http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/ 

2. Uninstalling error "Internal error: Cannot find utCompiledCode record for
this version of uninstaller". 

	You can delete the old installation directory and remove the
registry entries manually or use a program such as CCleaner to remove the
registry entries.  

Cem


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Gene Leynes
Sent: Monday, November 14, 2011 4:43 PM
To: r-help at r-project.org
Cc: Kevin Burton
Subject: Re: [R] Upgrade R?

I have had similar problems.

I have several installations of R and now I have no control over which one
opens when I try opening a RData file.  The RGUI is registered more than
once, but they all have the exact same appearance in the "choose programs"
menu.

It's become particularly annoying now that new versions of R seem to be
published with ever increasing frequency.



On Mon, Nov 14, 2011 at 10:11 AM, Kevin Burton
<rkevinburton at charter.net>wrote:

            
2.13.2 took up has been reclaimed.
manually:
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.