[R] How can i do an automatic upgrade of R 2.5.1 to R 2.7.1

Thibaut Jombart jombart at biomserv.univ-lyon1.fr
Mon Jul 7 10:51:40 CEST 2008


Dear Jason,

I don't know if this interests you, but one thing you might want to do 
while 'upgrading' (in fact it is just a new installation) is re-install 
all the packages that were installed on your previous R version.

I made a small script to do so:
###
reinst.pack <- function(pathToOldR){

instDir <- paste(pathToOldR,"/library/",sep="")
pack <- dir(instDir)
basePack <- sub("/base","", system.file())
basePack <- dir(basePack)

pack <- setdiff(pack,basePack)
pack

install.packages(pkg=pack)

}
###

You just have to launch the script from your new R version, giving it 
the path to the old version of R.
For instance I had to do:
###
 > reinst.pack("/usr/local/lib64/R-2.6.0/")
also installing the dependency ‘spam’

essai de l'URL 
'http://cran.univ-lyon1.fr/src/contrib/spam_0.13-1.tar.gz' 
<http://cran.univ-lyon1.fr/src/contrib/spam_0.13-1.tar.gz%27>
Content type 'application/x-tar' length 212961 bytes (207 Kb)
URL ouverte
==================================================
downloaded 207 Kb

[...]

###

It should work if you packages where installed at the default place.

Cheers,

Thibaut.



>
> Jason Lee schreef:
>> Hi,
>>
>> I am aware this is somehow FAQ question but I ve been searching from 
>> R-cran
>> archive about the related matter and could not find anything closer 
>> to this.
>>
>> I want to upgrade my R version from 2.5.1. to 2.7.1. What is the best 
>> way to
>> load the latest one apart from installing the packages (tar.gz) from
>> http://cran.ms.unimelb.edu.au/?
>>
>>
>> Please help.
>>
>> Thanks..
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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.
>
>


-- 
######################################
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
jombart at biomserv.univ-lyon1.fr
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/



More information about the R-help mailing list