From edd at debian.org  Wed Mar  2 12:18:13 2016
From: edd at debian.org (Dirk Eddelbuettel)
Date: Wed, 2 Mar 2016 05:18:13 -0600
Subject: [Rd] install.packages() fails with drat repository on
	networkdrive
In-Reply-To: <CAJuCY5w-BC8ePSD_-g=tcRiWgtQ9ik-FSaDWz1WwZLtC4yKBcw@mail.gmail.com>
References: <CAJuCY5w-BC8ePSD_-g=tcRiWgtQ9ik-FSaDWz1WwZLtC4yKBcw@mail.gmail.com>
Message-ID: <22230.52213.475906.844429@max.nulle.part>


Hi Thierry,

On 2 March 2016 at 10:16, Thierry Onkelinx wrote:
| Dear all,
| 
| install.packages("lme4") fails with error
| Error in read.dcf(file = tmpf) : cannot open the connection
| In addition: Warning message:
| In read.dcf(file = tmpf) :
|   cannot open compressed file
| '//servername/repository_path/bin/windows/contrib/3.2/PACKAGES',
| probable reason 'No such file or directory'
| 
| the repositories set in .Rprofile are
| "http://lib.ugent.be/CRAN/" "file://servername/repository_path"
| 
| There is a file PACKAGES.gz at
| //servername/repository_path/bin/windows/contrib/3.2/ but no file
| PACKAGES
| 
| I'm not sure if this is
| 1) a bug in the drat package: not creating PACKAGES
| 2) a bug in read.dcf(): not looking if PACKAGES.gz is present
| 3) a bug in available.packages(). Debugging install.packages()
| indicates that the error occurs at the line below with type <-
| "win.binary", repos <- getOption("repos") and missing(method) == TRUE
| 
| av2 <- available.packages(contriburl = contrib.url(repos, type2),
| method = method)
| 
| It would be nice if available.packages() handled an error returned by
| read.dcf() more gracefully. An error with one repository now
| completely blocks install.packages()

I also found the file semantics over the network drive to be tricky to get
right.  In the drat documentation I refer to 'file://...' but I found
accessing via http to be easier.

But it still works.  Quick example from work with one local repo (which I
just copied to /tmp here):

R> AP <- available.packages()
R> dim(AP)
[1] 8048   17
R> options("repos")
$repos
                      CRAN                      Local 
"https://cran.rstudio.com"             "file://tmp/R" 

R> 

As you can see this uses the file:// notation just fine.  We can also drill
down:


R> r <- c("CRAN"="https://cran.rstudio.com", "Local"="file://tmp/R")
R> options("repos"=r[1])
R> options("repos")
$repos
                      CRAN 
"https://cran.rstudio.com" 

R> dim(AP <- available.packages())
[1] 8009   17
R> options("repos"=r[2])
R> dim(AP <- available.packages())
[1] 46 17
R> 

As I recall, there may have been extra complications on Windows with network
drives.  

But if there is something (maybe documentation ?) that drat could/should do
better please feel free to open an issue ticket.

Hth,  Dirk

| 
| sessionInfo("drat")
| R version 3.2.3 (2015-12-10)
| Platform: i386-w64-mingw32/i386 (32-bit)
| Running under: Windows 7 x64 (build 7601) Service Pack 1
| 
| locale:
| [1] LC_COLLATE=Dutch_Belgium.1252  LC_CTYPE=Dutch_Belgium.1252
| LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C
| LC_TIME=Dutch_Belgium.1252
| 
| attached base packages:
| character(0)
| 
| other attached packages:
| [1] drat_0.1.0.1
| 
| loaded via a namespace (and not attached):
| [1] graphics_3.2.3  tools_3.2.3     utils_3.2.3     grDevices_3.2.3
| stats_3.2.3     datasets_3.2.3  methods_3.2.3   base_3.2.3
| fortunes_1.5-3
| 
| 
| Best regards,
| 
| 
| ir. Thierry Onkelinx
| Instituut voor natuur- en bosonderzoek / Research Institute for Nature
| and Forest
| team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
| Kliniekstraat 25
| 1070 Anderlecht
| Belgium
| 
| To call in the statistician after the experiment is done may be no
| more than asking him to perform a post-mortem examination: he may be
| able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
| The plural of anecdote is not data. ~ Roger Brinner
| The combination of some data and an aching desire for an answer does
| not ensure that a reasonable answer can be extracted from a given body
| of data. ~ John Tukey
| 
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



[Rd] install.packages() fails with drat repository on networkdrive
Dirk Eddelbuettel