[Rd] wish list: automatic package installation

Hiroyuki Kawakatsu hkawakat at gmail.com
Sun Apr 19 13:40:56 CEST 2009


Apologies for using this thread for something that is only
tangentially related.

Is there a mechanism in R to ensure that the configure.args used to
build R is also used when installing packages? If not, I would like to
add this as wish (perhaps we can grab this info from config.log?) At
the moment, I add the line


in my .Rprofile and install.packages() would use them. However, if I
change these when building R, I need to remember to change my
.Rprofile as well.


On Sun, Apr 19, 2009, John Fox wrote:
> Dear list members,
> The release of R 2.9.0, reminds me of a long-standing nit that I have to
> pick. I prefer not to transfer and update all of the packages in my old
> library, because I see a new release of R as an opportunity to start with a
> clean slate. I'd rather install packages as I need them. My personal
> solution is to use the following function in place of library():
> package <- function(package, dependencies=TRUE, ...){
>     package <- as.character(substitute(package))
>     if (!(package %in% .packages(all.available=TRUE)))
>        install.packages(package, dependencies=dependencies)
>    library(package, character.only=TRUE, ...)
>    }
> I'm sure that this function could be improved, and possibly I've missed a
> facility that's already available. If not, it would be nice if the library()
> command automatically tried to download and install missing packages
> (perhaps if an option is set).
> Regards,
>  John
> ------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox

| Hiroyuki Kawakatsu
| Business School, Dublin City University
| Dublin 9, Ireland. Tel +353 (0)1 700 7496

More information about the R-devel mailing list