Updating an R installation

update.packages() function can be used to download and install the most recent  version of a contributed package.

http://cran.r-project.org/bin

The installed.packages() function is used to save a list of packages to a location  outside of the R director y tree, and then the list is used with the install.packages()  function to download and install the latest contributed packages into the new R installation.

Here are the steps:

1 If you have a customized Rprofile.site file (see appendix B), save a copy outside of R.

2 Launch your current version of R and issue the following statements

oldip <- installed.packages()[,1]

save(oldip, file="path/installedPackages.Rdata")

where path is a director y outside of R.

3 Download and install the newer version of R.

4 If you saved a customized version of the Rprofile.site file in step 1, copy it into the new installation.

5 Launch the new version of R, and issue the following statements

load("path/installedPackages.Rdata")

newip <- installed.packages()[,1]

for(i in setdiff(oldip, newip))

  install.packages(i)

eg:

 

oldip <- installed.packages()[,1]
save(oldip, file="D:\\app\\rlib\\installedPackages.Rdata")

 

# down load from http://cran.r-project.org/
load("D:\\app\\rlib\\installedPackages.Rdata")
newip <- installed.packages()[,1]
for(i in setdiff(oldip, newip))
install.packages(i)

 

 

where path is the location specified in step 2.

6 Delete the old installation (optional).

 

source(http://bioconductor.org/biocLite.R)

biocLite("globaltest")

biocLite("Biobase")