[R] another superscript problem

David Winsemius dwinsemius at comcast.net
Tue Dec 28 01:51:24 CET 2010

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:

  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  
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

More information about the R-help mailing list