[R] package argument to library as string

David Brahm brahm at alum.mit.edu
Thu Nov 29 15:47:18 CET 2001

Dave Kane <a296180 at onyx.fmr.com> (my next-door neighbor) wrote:
>  R> pkg <- "ts"
>  R> library(pkg)
>     Error in library(pkg) : There is no package called `pkg'

You need:
R> library(pkg, character.only=TRUE)

                              -- David Brahm (brahm at alum.mit.edu)
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 mailing list