lifecycle Travis-CI Build Status CRAN_Status_Badge

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-",
  dev = "svg"
)

vegablock

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.

Installation

For now, you can install vegablock from GitHub:

# install.package("devtools")
install_github("vegawidget/vegablock")

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

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.

Examples

library("vegablock")
library("vegawidget")

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

vw_create_block(spec_mtcars)
message(
  "block url: https://bl.ocks.org/06a512525fbe7a96e1a2028e1871b61c\n",
  " gist url: https://gist.github.com/06a512525fbe7a96e1a2028e1871b61c"
)

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:

vw_retrieve_block("06a512525fbe7a96e1a2028e1871b61c")


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