On 4/9/2008 3:22 PM, Thomas Hoffmann wrote:
> Dear listmembers
> 
> I would like to create an expression that looks like
> 
> labl = expression(10^1,10^2,10^3,10^4,10^5)
> 
> using a for-loop. However
> 
> for (i in 1:5){ labl[i]=expression(10^i) }
> 
> does not do the right thing. Does anybody knows help?

labl <- expression()
for (i in 1:5) labl[[i]] <- bquote(10^.(as.numeric(i)))

(The as.numeric() might not be necessary if you don't care if the 
exponent prints as 1L, 2L, etc.  plotmath() handles it fine.)

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to