Convenience wrapper around plot_data() and utils::write.csv() for
publishing the numbers behind a figure next to the figure itself.
write_plot_data(plot, file, layer = NULL)A GgnextPlot.
Output path. With multiple layers and no layer given, the
layer index is inserted before the extension
(fig.csv -> fig-1.csv, fig-2.csv).
Optional layer index (see plot_data()).
The file path(s) written, invisibly.
p <- ggnext(cars, aes(speed, dist)) + geom_point()
out <- file.path(tempdir(), "cars.csv")
write_plot_data(p, out)