These functions do the same thing: create a gist; they differ only in what
they return. vw_create_block()
returns a copy of spec
so that it can be
used in a pipe; vw_create_block_gistid()
returns a list of information
about the newly-created gist.
vw_create_block(spec, embed = vega_embed(), .block = vw_block_config(), version = vega_version(major = FALSE), description = NULL, readme = NULL, use_thumbnail = TRUE, use_preview = TRUE, git_method = c("https", "ssh"), endpoint = NULL, env_pat = NULL, block_host = NULL, quiet = FALSE, browse = TRUE) vw_create_block_gistid(spec, embed = vega_embed(), .block = vw_block_config(), version = vega_version(major = FALSE), description = NULL, readme = NULL, use_thumbnail = TRUE, use_preview = TRUE, git_method = c("https", "ssh"), endpoint = NULL, env_pat = NULL, block_host = NULL, quiet = FALSE, browse = TRUE)
spec | object to be coerced to |
---|---|
embed |
|
.block |
|
version | named |
description |
|
readme |
|
use_thumbnail |
|
use_preview |
|
git_method |
|
endpoint |
|
env_pat |
|
block_host |
|
quiet |
|
browse |
|
Called for side effects
create_block()
returns an invisible copy of spec
create_block_gistid()
returns a list with elements:
endpoint
character
, git API endpiont
id
character
, gist id
You will need a GitHub Personal Access Token (PAT)
stored in an environment variable called GITHUB_PAT
.
See Happy Git with R
for more information on how to acquire and store a PAT.
If you are the default ("https"
) method to upload your gist, you will need to
set another environment variable, GITHUB_USERNAME
, according to your particular
account.
The default versions of the Vega JavaScript libraries are this package's
supported versions. To use the major (current) versions instead, use
version = vega_version(major = TRUE)
.
If want to include preview and thumb images with the block, you will need nodejs installed on your system, and the processx and magick packages.
Blocks documentation,
vw_retrieve_block()
,
gistr::gist_create_git()
, vega_version()
, vw_block_config()
# NOT RUN { # use supported versions vw_create_block(spec_mtcars) # use major versions vw_create_block(spec_mtcars, version = vega_version(major = TRUE)) # return gist information vw_create_block_gistid(spec_mtcars) # }