0

I have an R script that must read the packages available in a local repository stored on a network location, and I'm using UNC path to refer to that network location:

currPkgs <- pkgAvail(repos="\\\\abc-def.net\\packages\\cran", type="win.binary", Rversion=3.6)[,1]

However I got the error:

Error in read.dcf(file = tmpf) : cannot open the connection
In addition: Warning message:
In read.dcf(file = tmpf) :
  cannot open compressed file '/\\abc-def.net/packages/cran/bin/windows/contrib/3.6/PACKAGES', probable reason 'No such file or directory'

The function seems to change the slashes in my UNC path so '' were changed to '/' and added an invalid '/\' to the beginning of the path. I've double checked and the file \abc-def.net\packages\cran\bin\windows\contrib\3.6\PACKAGES is definitely present and not corrupted. How do I refer the UNC path properly so that pkgAvail() can find the file?

Thanks!

user9367574
  • 91
  • 1
  • 7
  • I did more testing and the path doesn't seem to be the problem here. If I do: read.dcf(file = '/\\abc-def.net/packages/cran/bin/windows/contrib/3.6/PACKAGES') the command runs ok without any issues. I don't really understand what's the problem here. – user9367574 Jan 07 '22 at 18:24
  • For others still stumbling here after googling this issue. pkgAvail seems to be the issue, no idea why. I don't have a fix, but addPackage and addLocalPackage from miniCRAN seem to work fine with a UNC path. I got the built in utils::available.packages working with something like available.packages(repos="file:////abc-def.net/packages/cran") – dww142 Oct 25 '22 at 22:12

0 Answers0