RODProt (version 0.2.0)

get_resource: Download Data Package Resource

Description

Download a resource referenced by a Data Package.

Usage

get_resource(dataPkg, resource, cache = TRUE, ...)

Arguments

dataPkg
The Data Package (as loaded from read_data_package) to use.
resource
A character string specifying the names of the resource to retrieve from the Data Package. At the time of development, it was unclear exactly how a resource would be indexed (see https://github.com/dataprotocols/dataprotocols/issues/32), thus the package supports a variety of indexing mechanisms for resources. The order of precedence is as follows:
  1. Keys from the resources hash - If the resources value was provided as a JSON hash instead of an array, the required name prefacing each resource will be used as that resource's canonical name.
  2. The id field within each resource will be checked for any exact matches.
  3. The name field within each resource will be checked for any exact matches.
  4. The url and path fields within each resource will be checked for any exact matches.
  5. The url and path fields within each resource will be checked for partial matches on the extracted portion of a // reference. The path is extracted using dirname and ignored to see if the remainder of the string matches (with the possible exclusion of a prefacing slash).
cache
Whether or not to cache the resource once retrieved. If TRUE, (default) the function will check this Data Package to see if the resource has already been cached. If it has, it will simply return the resource from the cache. If it has not, the function will retrieve the remote resource then save a copy in this package's cache. Note that this will involve storing an extra copy of the data, doubling memory usage. If FALSE, the function will retrieve the resource remotely, but not store the result in the cache when returning. The third option is to set cache to "flush". When this occurs, the function will retrieve the resource remotely, ignoring any pre-existing local copy, and store the result in the cache for future use.
...
Arguments to be passed on to read_json_table.