[R] titles with superscript and variale value

Monica Pisica pisicandru at hotmail.com
Sun Jan 27 22:29:34 CET 2008



Hi everyone,


I am trying to write a title for a plot which has a superscript like D^2 and a value of a variable stored in that variable..... i am not sure if i am clear so i will try an example:


 Suppose i want my title to be like: Family: Gaussian; D^2 = 0.45


 where i have the value 0.45 stored in variable d2 (which comes from some previous calculations, and depending which actual variables i am plotting, this d2 can have different values), and i want D^2 to be D superscrip 2.


 I've tried the following command lines:


> title(main = expression(paste( "Family: Gaussian; ", D^2, " = ", d2)))


 which gives me the right superscript but instead of the value stored in d2 i get actually "d2" .... or


> title(main = paste("Family: Gaussian; ", expression(D^2), " = ",d2))


 which gives me the real value stored in d2 but no superscript for D .... it comes like D^2 instead.


 I've tried few other command lines  more foolish than the ones above .... with no result. I will really appreciate if you have any suggestions to get this title right.


 Thanks,


 Monica

_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star power.

n


More information about the R-help mailing list