govcan_dl_resources: Download the resources attached to a specific record or (i.e....

View source: R/govcan_dl_resources.R

govcan_dl_resourcesR Documentation

Download the resources attached to a specific record or (i.e. a CKAN package) or to a stack of packages

Description

Download resources attached to a specific record or (i.e. a CKAN package) or to a stack of packages.

Usage

govcan_dl_resources(resources, excluded, included, path, id_as_filename, ...)

## S3 method for class 'ckan_resource'
govcan_dl_resources(
  resources,
  excluded = NULL,
  included = NULL,
  path = ".",
  id_as_filename = FALSE,
  ...
)

## S3 method for class 'ckan_resource_stack'
govcan_dl_resources(resources, ...)

## S3 method for class 'character'
govcan_dl_resources(resources, ...)

## S3 method for class 'ckan_package'
govcan_dl_resources(resources, ...)

## S3 method for class 'ckan_package_stack'
govcan_dl_resources(resources, ...)

Arguments

resources

An object of class ckan_package_stack or ckan_package, or a specific resource id, or (i.e. a CKAN package), or an object of type ckan_resource or ckan_resource_stack.

excluded

(vector of characters) Files of this format(s) will not be downloaded (NULL ignores this filter and is the default value).

included

(vector of characters) Only the files of this format(s) will be downloaded (NULL ignores this filter and is the default value).

path

(character) name indicating where to store the data (default is the current working directory).

id_as_filename

(logical) Use the resource identifier as file name. This is particularly useful when two different resources have the same filename.

...

Curl arguments passed on to crul::verb-GET (see ckanr::ckan_fetch()).

Details

File names are handled internally.

Value

A tibble of the download metadata (file id, package id, url, download path, format, storage location, associated data).

Methods (by class)

  • ckan_resource: Method for ckan_resource objects.

  • ckan_resource_stack: Method for ckan_resource_stack objects.

  • character: Method for character objects.

  • ckan_package: Method for ckan_package objects.

  • ckan_package_stack: Method for ckan_package_stack objects.

Examples

## Not run: 
id <- "b7ca71fa-6265-46e7-a73c-344ded9212b0"
dir <- tempdir(check = TRUE)
res <- govcan_dl_resources(id, path = dir)

## End(Not run)


VLucet/rgovcan documentation built on Nov. 24, 2022, 6:52 p.m.