[R] package argument to library as string
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Nov 29 15:53:12 CET 2001
"David Kane <David Kane" <a296180 at mica.fmr.com> writes:
> > pkg <- "ts"
> > pkg
>  "ts"
> > library(pkg)
> Error in library(pkg) : There is no package called `pkg'
> > library(ts)
> > detach(2)
> > library("ts")
> What am I misunderstanding? Why isn't pkg treated the same as "ts" by library()?
Welcome to the world of nonstandard argument evaluation... Similar
issues relate to the argument to help et al.
Basically, we have been trying to be nice to the user and allow them
to "forget" putting quotes around the package name. As a consequence,
library(pkg) might also have been intended to load someones "prototype
kernel generator" or so, and there's really no way to tell. As David
B. points out there is a way to override this.
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help