[R] superscript characters in title with '+'

David Winsemius dwinsemius at comcast.net
Fri Oct 22 15:32:24 CEST 2010


On Oct 22, 2010, at 9:15 AM, DrCJones wrote:

>
> Hi,
> Thanks for all of your replies!
>
> David, a slightly modified version of what you gave did the trick:
>
> hist(X,main = expression("["*Ca**""^paste(2,"+")*"]i"~'onsets'))
>
> But I prefer the way '2+' is italicized in the solution Dennis gave:

I agree. Dennis' version was more compact. And it worked if simply  
used as an argument to expression(), and it generalizes to  
substitution. Superior in every way.
>
> hist(X, main = bquote('[Ca'^'2+'*']i'~'onsets'), xlab = 'sec')
>
> I think I understand it now - the '^' symbol must be followed by the  
> '*'
> symbol to signify the end of font italicization;

Er, I don't see any italics in the output or implied by the expression.

> and '~' must be used to
> signify spaces. The only thing I still don't get is why square  
> brackets
> rather than quotation marks surround the 'i' in the solution Claudia  
> gave:
>
> hist(X, main=expression("[" * Ca^"2+" * "]" [i]~'onsets'),  xlab =  
> 'sec')
>

Because the "[]" function in plotmath does subscripting. I guess she  
figured that was what you wanted.

You really need to study ?plotmath some more.

>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/superscript-characters-in-title-with-tp3006981p3007188.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list