I want to know whether it is possible to see the code of a plot that is stored in a variable. For example, given the following plot:
library(ggplot2)
myData <- data.frame(x=1:100, y = 100:1)
myPlot <- ggplot(myData, aes(x,y)) + geom_line()
I'd like to have a function "seeCode" that returns the actual code used to construct the plot:
>seeCode(myPlot)
ggplot(myData, aes(x,y)) + geom_line()