You can use this function to retrieve a vegaspec
from
blocks (gists) where the spec is in its own JSON file.
vw_retrieve_block(id, file = NULL, endpoint = NULL, env_pat = NULL, quiet = FALSE)
id |
|
---|---|
file |
|
endpoint |
|
env_pat |
|
quiet |
|
S3 object of class vegaspec
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.
# 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" ) # }