[Rd] Error on Windows installing package to non-default library
Seth Falcon
sfalcon at fhcrc.org
Wed Mar 2 16:45:43 CET 2005
Hi all,
I'm seeing an error on Windows when I try to install a package to a
package library path that starts with a digit. I can reproduce the
error as follows using R-devel from Feb 24 on Windows advanced server:
badLib = "c:\\badExample\\2\\foo"
dir.create(badLib, recursive=TRUE)
z = .libPaths()
z = .libPaths(c(badLib, z))
z
[1] "c:\\badExample\\2\\foo" "C:/falcon/sw/rw2010dev/library"
pkg = "c:\\falcon\\abind_1.1-0.zip"
install.packages(pkg, repos=NULL, lib=badLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
Error in gsub("^URL: ../../../library", lib0, readLines(cfile)) :
invalid backreference 2 in regular expression
After looking at src/library/utils/R/windows/linkhtml.R, it seems the
error is that the "\\2" part of the path is interpreted by gsub as a
back reference.
Changing "\\" to "/" in the library path fixes this issue:
> okLib = chartr("\\", "/", badLib)
> z = .libPaths(okLib)
> z
[1] "c:/badExample/2/foo" "C:/falcon/sw/rw2010dev/library"
> install.packages(pkg, repos=NULL, lib=okLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
So adding a call to chartr inside make.search.html would seem to be an
improvement (i.e, it looks good from here, but I haven't tested and
don't know if there are reasons why this would be a bad idea). OTOH,
maybe this should have already happened in the call to .libPaths()?
This came up because on the Windows server I'm using, tempdir()
contains a directory names "2" as part of the path --- and I want to be
able to install package to temporary package libraries for testing
purposes.
+ seth
More information about the R-devel
mailing list