Skip to contents

Configure a reference source

Usage

reference_source(
  url,
  cache = tempfile("form.model-"),
  headers = NULL,
  timeout = 60,
  max_connections = 4L
)

Arguments

url

HTTP(S) base URL or local directory containing the selected catalogue.yaml and catalogue.csv files. URLs must not contain credentials, query strings or fragments.

cache

Local cache directory. Defaults to a new temporary directory for this source in the current R session. Supply an explicit path to retain files across sessions. Different sources receive separate subdirectories. Use separate caches for separate authenticated identities.

headers

Named HTTP header values, or a function returning them at request time. NULL sends no authentication headers.

timeout

Positive request timeout in seconds.

max_connections

Maximum simultaneous CSV downloads. The default is four.

Value

A reference_source object. No files are downloaded.

Details

Credentials stay in memory and are never written into the cache. Authenticated requests do not follow redirects; supply the final base URL.

Examples

# Configure the reference catalogue sources.
reference_source_configuration <- reference_source(
  system.file("examples", "survey", "catalogue", "code_lists", package = "form.model"),
                           cache = tempfile("references-"))
# Configure the reference catalogue sources.
reference_source_configuration
#> Reference source: /tmp/RtmpQGdfYQ/temp_libpath82e256c0e1d/form.model/examples/survey/catalogue/code_lists
#> Cache: /tmp/RtmpQGdfYQ/references-82e934ecdb