vw_set_base_url {vegawidget} | R Documentation |
Set base URL
Description
This is useful for specs where data is specified using a URL. Using this function to set the base URL, you can specify the data URL in specs using the relative path from the base.
For example, this
Vega-Lite example
uses the base URL https://cdn.jsdelivr.net/npm/vega-datasets@2
. In a spec,
instead of specifying:
data = "https://cdn.jsdelivr.net/npm/vega-datasets@2/data/cars.json"
You can call:
vw_set_base_url("https://cdn.jsdelivr.net/npm/vega-datasets@2")
Then specify:
data = "data/cars.json"
This function sets the value of getOption("vega-embed")$loader$baseURL
.
You need set it only once in a session or RMarkdown file.
Usage
vw_set_base_url(url)
Arguments
url |
|
Value
character
called for side effects, it returns the previous value
invisibly.
Examples
# this is the URL used for Vega datasets
previous <- vw_set_base_url("https://cdn.jsdelivr.net/npm/vega-datasets@2")
# reset to previous value
vw_set_base_url(previous)
[Package vegawidget version 0.5.0 Index]