[R] Varying texts in expression(paste())

Morten Sickel Morten.Sickel at nrpa.no
Fri Jan 31 14:34:02 CET 2003


Hi,

I am using R a lot to make plots relating to radioactivity, I am often using
expression() to label the plots with nuclide names written with
superscripts, e.g. 
	expression(paste("Releases of ", { }^{99},Tc," (TBq/year)"))->ywtext
But, is there any simple way to change the number and name of the nuclide
through a variable? I tried 
	nuccode=expression({ }^{99},Tc)
expression(paste("Releases of ", as.expression(nuccode) ,"
(TBq/year)"))->ywtext

But, obiously, since as.expression does not return a chr, it was used
literally in the text on the figure, i.e. "Releases of
as.expression(nuccode) (TBq/year)" which definiately was not what I
wanted... 

should I use some other wrapper function on the expression, or are there
some other ways of making superscripts in figure texts?

regards

Morten

-- 
Morten Sickel
Norwegian Radiation Protection Authority
http://www.nrpa.no




More information about the R-help mailing list