I think you are looking for substitute
:
returns the parse tree for the (unevaluated) expression expr, substituting any variables bound in env
And by way of an example:
df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),
y = rnorm(30))
## Make an aes
tmpaes <- aes(x = gp, y = y , ymin = -2 , ymax = 2 )
## Plot with it
ggplot(df) +
geom_point( tmpaes )
## Modify aes with a new variable
new <- 10
tmpaes$ymax <- substitute( new )
## replot
ggplot(df) +
geom_point( tmpaes )