This package contains a small plugin for using files from some shared location within orderly2
. Unlike orderly2::orderly_shared_resource
, the assumption here is that the files are somewhere out of the source tree, for example a mounted shared drive that multiple people access.
We expect that the files are to be read into a running task/report are read only and are a source of information, not a destination to write things to.
Configuration
This may change as and when we overhaul orderly2
’s configuration; we would like to entirely remove the yaml, and are open to suggestions.
Edit your orderly_config.yml
to add a section like
where /path/to/database
is the full (absolute) path to the files that you want to use from within orderly tasks/reports. As a shorthand you could also write database: /path/to/database
.
You can have more than one entry here, for example:
uses the shorthand form to set up two shared locations, one called malaria
and the other dengue
.
If you are not the only person that is going to be running things that use this shared resource, you will need to make it configurable per-user. The easiest way to do this is to set paths within a file orderly_envir.yml
(which should be excluded git) and reference environment variables from here within the configuration. So for example you might have an orderly_envir.yml
that contains:
and then within the orderly_config.yml
:
Usage
After the plugin is configured as above, you can use it from a task/report:
path_db <- orderly.sharedfile::sharedfile_path(
"database/v1.mdb", from = "malaria")
The from
argument is optional if you only have a single shared location configured. After running this statement, the variable path_db
contains the absolute path to your database and you can pass this your db driver.
You might use a similar approach to access large shapefiles, genomic sequences, etc.
You can return vectors of paths, for example:
path <- orderly.sharedfile::sharedfile_path(c("a", "b"))
will return a vector of length two, with the paths for files a
and b
in a configuration that uses only a single shared directory.
Metadata
We save the hash of all files found, along with their full names. If the returned path is a directory, all contents are hashed.