0

In R, connections supported by url() function support the scheme:

  • file://
  • http://
  • https://
  • ftp://

There is additional support in other packages:

but i do not find anything to introduce some custom schema/protocol handler.

Something similar to Java URLStreamHandler

In particular, I'm looking for a way to reference data from local library packages in a "uniform" way. Something like this:

for current package:

  • data:///my-dataset.rda, mapping to data folder
  • extdata:///folder1/my-datafile.txt, mapping to [inst]/extdata/folder1

for imported packages:

  • data://imported-pkg/other-dataset.rda
  • extdata://imported-pkg/folder2/other-datafile.txt

There are several functions that enable this:

but mixing network URLs and internal references in not uniform ...

hute37
  • 197
  • 2
  • 8
  • 1
    That's what `system.file()` is for. Maybe explain why that doesn't work for you. – Thomas Jan 20 '16 at 15:14
  • Java resource "classpath" urls: http://stackoverflow.com/questions/861500/url-to-load-resources-from-the-classpath-in-java/1769454#1769454 – hute37 Jan 20 '16 at 16:00
  • URL parsing with [urltools](https://github.com/Ironholds/urltools/blob/master/vignettes/urltools.Rmd). An interesting [article](http://www.r-bloggers.com/importing-data-into-r-from-different-sources/) – hute37 Jan 20 '16 at 16:10

0 Answers0