Add, edit, or refresh a view within a data commons project.
Usage
datacommons_view(commons, name, output = NULL, ..., variables = NULL,
ids = NULL, files = NULL, run_after = NULL, run_before = NULL,
measure_info = list(), remote = NULL, url = NULL, children = list(),
execute = TRUE, prefer_repo = TRUE, preselect_files = FALSE,
refresh_map = FALSE, overwrite = FALSE, verbose = TRUE)
Arguments
- commons
Path to the data commons project.
- name
Name of the view (it's directory in the project's
"views"
directory). Defaults to the first view.- output
Path to a site project's main directory.
- ...
Passes arguments to
data_reformat_sdad
if the view is to be executed.- variables
A vector of variables, to be added to the view's
view.json
file.- ids
A vector of ids, to be added to the view's
view.json
file.- files
A regular expression string used to filter files containing
variables
.- run_after
Path to a script to be sourced after refreshing the view, or code to be added to such a script (e.g.,
"../data_site/build.R"
).- run_before
Path to a script to be sourced before refreshing the view, or code to be added to such a script.
- measure_info
A list of variable metadata to include in the
measure_info.json
file created from such files in each data repository (such as general entries like"_references"
). These will supersede any entries of the same name found in data repositories.- remote
Name of the view's GitHub repository (
"username/reponame"
).- url
URL of the view's site; defaults to the GitHub Pages URL associated with
remote
if provided ("https://username.github.io/reponame"
).- children
A list of child sites associated with the view. Each entry should contain at least a
remote
entry (GitHub repository, including user name and repo name), and optionallyname
andurl
(link to the served site), which will otherwise be derived fromremote
.- execute
Logical; if
FALSE
, will create/update, but not run the view.- prefer_repo
Logical; if
FALSE
, will prefer distribution files (such as from Dataverse) over those in the repositories.- preselect_files
Logical; if
TRUE
, will select files by ID coverage before processing them, which can save time, but might miss data spread across multiple files.- refresh_map
Logical; if
TRUE
, overwrites any existing map files.- overwrite
Logical; if
TRUE
, reformatted files inoutput
.- verbose
Logical; if
FALSE
, will not show status messages.
Examples
if (FALSE) {
# create a view within a data commons project
datacommons_view(".", "view_name", variables = c("variable_a", "variable_b"))
# refresh that view
datacommons_view(".", "view_name")
}