# [R] another superscript problem

Peter Ehlers ehlers at ucalgary.ca
Tue Dec 28 02:22:26 CET 2010

```On 2010-12-27 16:51, David Winsemius wrote:
>
> On Dec 27, 2010, at 6:40 PM, T.D. Rudolph wrote:
>
>>
>> I've exceeded the maximum time I am willing to accept for solving
>> simple
>> problems so I thank all in advance for your assistance.
>>
>> I am trying to plot text combined with an object value and a
>> superscript.
>>
>> obv = 5
>> text = "Population mean ="
>> ss = ^o # degrees
>>
>> Something like this (very naive so you get the idea):
>> expression(text, obv, ss)
>>
>> paste(text, obv) # works ...but of course I either lose the value of
>> obv or
>> the superscript in the translation using expression, and bquote
>> doesn't seem
>> to accept the asterisk before the first element.
>
> I had trouble figuring out your real intent, since you have only been
> describing what didn't work but see if this his halfway there:
>
> plot(1,1)
>    obv = 5
>    text = "Population mean ="  # you should really avoid using function
> names for variables!
>    text(.8,.8, bquote(.(text)~.(obv)^o) )
>
> The ^o seems a bit of a dodge but it looks ok so if you're happy, go

Instead of ^o, use the word 'degree' (see ?plotmath)

text(.8,.8, bquote(.(text)~.(obv)*degree) )

and, personally, I would let R handle the '=' sign:

txt <- "Pop mean"
text(1, 1.1, bquote(.(txt) == .(obv)*degree))

Peter Ehlers

> with it.
>>
>> I am a little bungled by the varying syntax used for bquote and all
>> the
>> rest; sometimes R seems more complicated than it needs to be for a
>> relatively simple problem (and for me this is one of those cases!)...
>>
>> Tyler
>> --
>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at 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.

```