Create Altair chart from vegaspec
as_chart(spec)
altair object
An object to be coerced to vegaspec, a Vega/Vega-Lite specification
vegaspec
if (interactive()) { as_chart(vegawidget::spec_mtcars) }
Run the code above in your browser using DataLab