[Rd] system.file() and .path.package() incorrect with package versions

Roger Peng rpeng at stat.ucla.edu
Wed Apr 30 18:24:46 MEST 2003


The system.file() and .path.package() functions appear to be unaware of
package versions and can return incorrect information or fail if a package
is installed using `installWithVers = TRUE' of install.packages().  For
example, I can run

> install.packages("session", "~/R-local/libs", installWithVers = TRUE)

and

> library(session, version = "1.0.1")

without a problem.  However,

> system.file(package = "session")
[1] ""

but

> system.file(package = "session_1.0.1")
[1] "/home/rpeng/R-local/libs/session_1.0.1"

which I kind of expected.  Also, .path.package() produces:

> .path.package()
[1] "/home/rpeng/R-local/libs/session_1.0.1"     
[2] "/home/rpeng/install/R/lib/R/library/methods"
[3] "/home/rpeng/install/R/lib/R/library/ctest"  
[4] "/home/rpeng/install/R/lib/R/library/mva"    
[5] "/home/rpeng/install/R/lib/R/library/modreg" 
[6] "/home/rpeng/install/R/lib/R/library/nls"    
[7] "/home/rpeng/install/R/lib/R/library/ts"     
[8] "/home/rpeng/install/R/lib/R/library/base"   

but

> .path.package(package = "session")
Error in .path.package(package = "session") : 
        none of the packages are loaded

This is problematic because many packages run their examples using
system.file() or .path.package() and those will not run when packages are
installed with versions.  Also, some packages call .path.package() in
.First.lib(), in which case the package will usually not even load.

> version
         _                
platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    1                
minor    7.0              
year     2003             
month    04               
day      16               
language R                

-roger
_______________________________
UCLA Department of Statistics
http://www.stat.ucla.edu/~rpeng



More information about the R-devel mailing list