The goal of vegablock is to provide an interface between Vega and Blocks.

The Blocks website provides a way to share JavaScript-based visualizations using GitHub gists; the vegawidget package provides a way to compose and render Vega(-Lite) (JavaScript) visualizations using R. This package provides a bridge between the Blocks website and the vegawidget package.

If you have a GitHub account, you can use this package to deploy Vega(-Lite) blocks. Further, if a block contains a Vega(-Lite) specification and meets a specific format, you can use this package to import such a specification to your R environment.


For now, you can install vegablock from GitHub:

To make things easiest, you should have these environment variables set in your .Renviron file:

  • GITHUB_PAT - a GitHub Personal Access Token (PAT) you create; its scope will have to include gists.

  • GITHUB_USERNAME - your GitHub-account name.

If want to include preview and thumb images with the block, you will need nodejs installed on your system, and the processx, rsvg, and magick packages.



With the environment variables set, you can create a block from vegaspec:

#> block url:
#>  gist url:

You can visit the created block here.

If the block has a specific format, where the Vega(-Lite) specification is in its own file, you can retrieve a vegaspec from a block into your R environment: