[R] contriburl argument to install.packages

Roger D. Peng rpeng at jhsph.edu
Fri Jul 16 14:14:19 CEST 2004


Argh, yes.  I forgot I was using R 1.9.0.  Everything works correctly 
in 1.9.1.

-roger

Uwe Ligges wrote:
> Roger D. Peng wrote:
> 
>> Hmm...is this maybe a bug?  Check out this section of install.packages():
>>
>>     localcran <- length(grep("^file:", contriburl)) > 0
>>     if (!localcran) {
>>         if (is.null(destdir)) {
>>             tmpd <- tempfile("Rinstdir")
>>             if (!dir.create(tmpd))
>>                 stop("Unable to create temp directory ", tmpd)
>>         }
>>         else tmpd <- destdir
>>     }
>>     foundpkgs <- download.packages(pkgs, destdir = tmpd, available = 
>> available,
>>         contriburl = contriburl, method = method)
>>
>> So if `localcran' is TRUE (which in this case, it is), then `tmpd' 
>> never gets defined but is passed to download.packages().
> 
> 
> The help pages tells us (correctly):
> "If CRAN is local, i.e., the URL starts with "file:", then the packages 
> are not downloaded but used directly."
> hence we don't need a destdir in this case, therefore no need to define 
> tmpd.
> 
> 
>> When I run a traceback() after getting the error from running 
>> install.packages(), it fails in download.packages() when trying to 
>> create the download directory.
> 
> 
> Works for me without any error. Are you sure the path you specified was 
> correct? If you are sure, is this R-1.9.1?
> 
> Uwe Ligges




More information about the R-help mailing list