Frequently, I use functions to shape or numerically alter data that I'm passing to ggplot, so that I don't have to alter my data before putting it in.
If I've saved a plot to a variable. Is there a way to see the actual data that I'm plotting? It's a sanity check.
For example:
c <- ggplot(mtcars, aes(factor(cyl))) + geom_bar()
If I type str(c)
, I'm presented with $data at the top, but I would like to see it in tabular form.