take_snapshot: Snapshots datasets and the configuration file

Description Usage Arguments Value See Also Examples

View source: R/take_snapshot.R

Description

Snapshots datasets and the configuration file

Usage

1
2
3
4
5
6
take_snapshot(
  datasets = NULL,
  destdir = NULL,
  overwrite = FALSE,
  config = get_config()
)

Arguments

datasets

Character vector giving the name of a file (without extension) in which to write the snapshot. It must exactly match the name of an exported dataset or of a functions which output is a datasets. NULL defaults to take a snapshot of all possible datasets.

destdir

Character vector giving the path to the directory to write to. NULL defaults to the working directory.

overwrite

TRUE overwrites existing snapshots (data and configuration file).

config

Path to a configuration file.

Value

Returns NULL. It's called for its side effect.

See Also

get_config.

Other handle snapshots: possible_snapshots()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 
library(r2dii.utils)

# Use `config` to provide a local, custom configuration file, locally -- to
# affect this specific call to `take_snapshot()`
datasets <- "DebtMarketClimate"
custom_config <- r2dii.utils::example_config("config-toy.yml")
take_snapshot(
  datasets,
  destdir = tempdir(), overwrite = TRUE, config = custom_config
)

# Use `options(r2dii_config = <custom_config>)` to provide a custom
# configuration file, globally -- to affect your entire R session
restore <- options(r2dii_config = custom_config)
take_snapshot(
  datasets,
  destdir = tempdir(), overwrite = TRUE
)

options(restore)

## End(Not run)

2DegreesInvesting/r2dii.dataraw documentation built on Nov. 2, 2021, 9:35 p.m.