recover_data {ggghost} | R Documentation |
Recover data Stored in a ggghost object
Description
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.
Usage
recover_data(x, supp = TRUE)
Arguments
x |
A ggghost object from which to extract the data. |
supp |
(logical) Should the supplementary data be extracted also? |
Details
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 iteractively, a warning will be produced if the data to be extracted exists in the workspace but not identical to the captured version.
Value
A data.frame
of the original data, named as it was when used
in ggplot(data)