The data used to generate a plot is an essential requirement for a
reproducible graphic. This is somewhat available from a ggplot grob
(in raw form) but it it not easily accessible, and isn't named the same way
as the original call.
recover_data(x, supp = TRUE)A data.frame of the original data, named as it was when used
in ggplot(data)
A ggghost object from which to extract the data.
(logical) Should the supplementary data be extracted also?
This function retrieves the data from the ggghost object as it was when it was originally called.
If supplementary data has also been attached using supp_data
then this will also be recovered (if requested).
When used interactively, a warning will be produced if the data to be extracted exists in the workspace but not identical to the captured version.