
Save a ggsql spec to a file
ggsql_save.RdThis function renders a specification and returns it either as a Vegalite json string, an SVG or a PNG. For the latter two, the Vegalite JSON is rendered to SVG using the V8 package and, potentially, converted to PNG using the rsvg package.
Arguments
- spec
A
Specobject returned byggsql_execute().- file
Output file path. Extension determines format:
.svg,.png, or.json.- width
Width in pixels.
- height
Height in pixels.
Examples
reader <- duckdb_reader()
ggsql_register(reader, mtcars, "cars")
spec <- ggsql_execute(reader,
"SELECT * FROM cars VISUALISE mpg AS x, disp AS y DRAW point"
)
svg_file <- tempfile(fileext = ".svg")
ggsql_save(spec, svg_file)