[R] Mathematical expression

Peter Dalgaard pdalgd at gmail.com
Fri Jul 23 00:15:51 CEST 2010


Uwe Ligges wrote:
> 
> On 22.07.2010 21:47, Filoche wrote:
>> Hi everyone.
>>
>> I'm trying to display the r^2 of a linear regression on a plot using
>> text(...). I first build the string to display.  However, I can't find why
>> this is not working (it display literally r^2 instead of r superscript 2).
>>
>> r2string = expression(paste(r^2)," = ", r2);
>>
>> Any help would be greatly appreciated,
>> Phil
> 
> r2string = substitute(r^2 == r2, list(r2=r2))

or bquote(r^2==.(r2))

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list