R: sequence of substituted expressions from sequence of values -


i want produce

list(quote(10^2), quote(10^3), quote(10^4),      quote(10^5), quote(10^6), quote(10^7)) 

from

seq(2,7) 

is there less gawdawful way than

mapply(function(n) substitute(10^x, list(x=as.double(n))), seq(2,7)) 

? have tried following:

> substitute(10^x, list(x=seq(2,7))) 10^2:7  > mapply(substitute, 10^x, x=seq(2,7)) error in mapply(substitute, 10^x, x = seq(2, 7)) : object 'x' not found  > mapply(function(n) substitute(10^n), seq(2,7)) list(10^dots[[1l]][[6l]], 10^dots[[1l]][[6l]], 10^dots[[1l]][[6l]],       10^dots[[1l]][[6l]], 10^dots[[1l]][[6l]], 10^dots[[1l]][[6l]]) 

try bquote:

lapply(as.numeric(2:7), function(x) bquote(10^.(x))) 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -