# NOT RUN {
vegawidget(spec_mtcars, width = 350, height = 350)
# vegaspec with a data URL
spec_precip <-
list(
`$schema` = vega_schema(),
data = list(url = "seattle-weather.csv"),
mark = "tick",
encoding = list(
x = list(field = "precipitation", type = "quantitative")
)
) %>%
as_vegaspec()
# define local path to file
path_local <- system.file("example-data", package = "vegawidget")
# render using local path (does not work with knitr)
vegawidget(spec_precip, base_url = path_local)
# }
# NOT RUN {
# requires network-access
# define remote path to file
url_remote <- "https://vega.github.io/vega-datasets/data"
# render using remote path
# note: does not render in RStudio IDE; open using browser
vegawidget(spec_precip, base_url = url_remote)
# }
Run the code above in your browser using DataLab