Skip to content
Prev 379066 / 398502 Next

Substitution in expressions

I think mapply() is fine. You could do
expression(1L^2, 2L^2, 3L^3, 4L^3, 5L^4)

but it is really not that much clearer and does mapply() internally anyway. There's no automatic vectorization in substitute/bquote, so you do need to do it manually. 

(You might have hoped that Vectorize(function(x,y) substitute(x^y)) would work, but it doesn't)

-pd