vw_retrieve_block: Retrieve vegaspec from block

Description Usage Arguments Details Value See Also Examples

Description

You can use this function to retrieve a vegaspec from blocks (gists) where the spec is in its own JSON file.

Usage

1
2
vw_retrieve_block(id, file = NULL, endpoint = NULL, env_pat = NULL,
  quiet = FALSE)

Arguments

id

character block id

file

character filename within block, NULL will retrieve first JSON file

endpoint

character, base endpoint for GitHub API, defaults to "https://api.github.com"; useful to specify with GitHub Enterprise, e.g. "https://github.acme.com/api/v3" (not yet implemented)

env_pat

character, name of environment variable that contains a GitHub PAT (Personal Access Token), defaults to "GITHUB_PAT"; Useful to specify with GitHub Enterprise, e.g. "GITHUB_ACME_PAT" (not yet implemented)

quiet

logical, indicates to supress messages

Details

You will need a GitHub Personal Access Token stored in an environment variable called GITHUB_PAT. See Happy Git with R for more information on how to acquire and store a PAT.

The file argument accepts a regular expression for the name of the JSON file within the gist. If you don't provide a file, it will return the first file in the gist with a .json extension (not case sensitive). Don't worry about escaping the dots in file, it will likely not make a difference.

Value

S3 object of class vegaspec

See Also

Blocks documentation, vw_create_block(), gistr::gist()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
  # https://bl.ocks.org/domoritz/455e1c7872c4b38a58b90df0c3d7b1b9
  spec_bars <-
    vw_retrieve_block("455e1c7872c4b38a58b90df0c3d7b1b9")
  spec_bars <-
    vw_retrieve_block("dmoritz/455e1c7872c4b38a58b90df0c3d7b1b9")
  spec_bars <-
    vw_retrieve_block(
      "455e1c7872c4b38a58b90df0c3d7b1b9",
      file = "bar.vl.json"
    )

## End(Not run)

vegawidget/vegablock documentation built on June 19, 2019, 9:56 p.m.