[R] package argument to library as string

David Kane <David Kane a296180 at mica.fmr.com
Thu Nov 29 15:35:27 CET 2001


The help page for library says that:

package, help: name or character string giving the name of a package.

Yet, I don't seem to be able to use a string variable here.

> version
         _                   
platform sparc-sun-solaris2.6
arch     sparc               
os       solaris2.6          
system   sparc, solaris2.6   
status                       
major    1                   
minor    3.1                 
year     2001                
month    08                  
day      31                  
language R                   
> pkg <- "ts"
> pkg
[1] "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()?

Thanks,

Dave Kane
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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