datacommons_view: Interact with a Data Commons View

View source: R/datacommons_view.R

datacommons_viewR Documentation

Interact with a Data Commons View

Description

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 optionally name and url (link to the served site), which will otherwise be derived from remote.

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 in output.

verbose

Logical; if FALSE, will not show status messages.

Value

An invisible version of the view list (the view's view.json file).

Examples

## Not run: 
# 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")

## End(Not run)

uva-bi-sdad/community documentation built on Oct. 12, 2023, 1:18 p.m.