Reputation: 44688
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.
Upvotes: 0
Views: 127
Reputation: 94277
c$data
Now I have to pad this out so stackoverflow doesn't reject it for being too small an answer.
Upvotes: 1