Well, that's a bit convoluted way (I really don't see the point of that "script") - if you want to re-install packages across R versions (not the topic of this thread!) it is far easier than that and I posted it here just a few days ago:
# for packages from user location: install.packages(row.names(installed.packages("~/Library/R/2.12/library"))) # for packages from system location: install.packages(row.names(installed.packages("/Library/Frameworks/R.framework/Versions/2.12/Resources/library"))) but as I said, the Package Manager gives you the latter without the need to type anything ... Cheers, Simon On May 24, 2011, at 11:07 PM, Tom Hopper wrote: > There's a handy script to automate the update process that I came across > some time ago at > https://bridgewater.wordpress.com/2010/12/21/my-favorite-r-packages-installed-with-one-command/ > > When you run the script, it will automatically install the libraries that > you set up in the script. When you run it, it will install into the first > location in .libPaths(). If you want packages installed in ~/Library/R..., > then you need to check the "Default Library Paths" option in > R-->Preferences-->Startup. Alternatively, you could supply the lib= argument > to the install.packages() call. With a little extra code, you could even > define the install location for each package individually. > > Here's a shortened version: > # Essential R packages: 2011-01-02 > # Originally from: R packages I use commonly: 12/21/2010 twitter: > drbridgewater > # Jeff S. A. Bridgewater > # > https://bridgewater.wordpress.com/2010/12/21/my-favorite-r-packages-installed-with-one-command/ > # > > #list all packages currently installed > p<-c() > > #add essential packages: > p<-c(p,"survival") > p<-c(p,"Hmisc") > # add more packages here > > # UPDATE the repository list to point to your local repositories > repositories<-c("http://mirrors.softliste.de/cran/"," > http://mirrors.softliste.de/cran/") > install_package<-function(pack,repositories) > { > if(!(pack %in% row.names(installed.packages()))) > { > update.packages(repos=repositories, ask=F) > install.packages(pack, repos=repositories, dependencies=T) > } > require(pack,character.only=TRUE) > } > > for( pack in p) > { > install_package(pack,repositories) > } > > [[alternative HTML version deleted]] > > _______________________________________________ > R-SIG-Mac mailing list > R-SIG-Mac@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-mac > > _______________________________________________ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac