[R] loading a package within R, in a MS Windows environment?
David Winsemius
dwinsemius at comcast.net
Fri Aug 20 21:45:33 CEST 2010
On Aug 20, 2010, at 3:25 PM, Eva Nordstrom wrote:
> I am using R 2.11.1 in a Microsoft Windows environment. Is there a
> way to load a
> package (e.g. the zoo package) using only "written code", not menus
> or mouse
> clicks?
>
> The "code" below code brings up the "Select One" [package] menu. I
> just want to
> automatically load the "zoo package".
>
> local({pkg <- select.list(sort(.packages(all.available =
> TRUE)),graphics=TRUE)
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
what's wrong with:
require(zoo) #?
I suppose you could do something fancier like:
stopifnot(require(zoo)) ... but I don't think that adds any benefit.
--
David
More information about the R-help
mailing list