bb_sync | R Documentation |
This function takes a bowerbird configuration object and synchronizes each of the data sources defined within it. Data files will be downloaded if they are not present on the local machine, or if the configuration has been set to update local files.
bb_sync(
config,
create_root = FALSE,
verbose = FALSE,
catch_errors = TRUE,
confirm_downloads_larger_than = 0.1,
dry_run = FALSE
)
config |
bb_config: configuration as returned by |
create_root |
logical: should the data root directory be created if it does not exist? If this is |
verbose |
logical: if |
catch_errors |
logical: if |
confirm_downloads_larger_than |
numeric or NULL: if non-negative, |
dry_run |
logical: if |
Note that when bb_sync
is run, the local_file_root
directory must exist or create_root=TRUE
must be specified (i.e. bb_sync(...,create_root=TRUE)
). If create_root=FALSE
and the directory does not exist, bb_sync
will fail with an error.
a tibble with the name
, id
, source_url
, sync success status
, and files
of each data source. Data sources that contain multiple source URLs will appear as multiple rows in the returned tibble, one per source_url
. files
is a tibble with columns url
(the URL the file was downloaded from), file
(the path to the file), and note
(either "downloaded" for a file that was downloaded, "local copy" for a file that was not downloaded because there was already a local copy, or "decompressed" for files that were extracted from a downloaded (or already-locally-present) compressed file. url
will be NA
for "decompressed" files
bb_config
, bb_source
## Not run:
## Choose a location to store files on the local file system.
## Normally this would be an explicit choice by the user, but here
## we just use a temporary directory for example purposes.
td <- tempdir()
cf <- bb_config(local_file_root = td)
## Bowerbird must then be told which data sources to synchronize.
## Let's use data from the Australian 2016 federal election, which is provided as one
## of the example data sources:
my_source <- bb_example_sources("Australian Election 2016 House of Representatives data")
## Add this data source to the configuration:
cf <- bb_add(cf, my_source)
## Once the configuration has been defined and the data source added to it,
## we can run the sync process.
## We set \code{verbose=TRUE} so that we see additional progress output:
status <- bb_sync(cf, verbose = TRUE)
## The files in this data set have been stored in a data-source specific
## subdirectory of our local file root:
status$files[[1]]
## We can run this at any later time and our repository will update if the source has changed:
status2 <- bb_sync(cf, verbose = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.