[R] margin text warning message NAs coercion

David Winsemius dwinsemius at comcast.net
Tue Feb 16 18:35:13 CET 2010


On Feb 16, 2010, at 12:18 PM, e-letter wrote:

> On 16/02/2010, Peter Ehlers <ehlers at ucalgary.ca> wrote:
>> On 2010-02-16 9:21, e-letter wrote:
>>> Readers,
>>>
>>> I tried to the following commands:
>>>
>>> plot(y~x,ylab=expression(A[1]~B[2],xlab=expression(C~D))
>>> mtext(expression(A[1]~B[2]),"additional text",side=3,line=1)
>>
>> Your plot() call is not reproducible.
>>
>> Anyway, try
>>
>> mtext(expression(A[1]~B[2]~~"additional text"),side=3,line=1)
>>
> Thank you. I had seen the command (~~) in the help guide for the
> package plotmath(grdevices), but there is no statement that this
> command can be used to join the expression to literal text.

It's not a "command", it's one of the available separators (or  
connectors depending on how you think about them) for expressions. If  
you wanted no separation between adjacent terms, you would use a  
"*" (asterisk). You cannot use "," because it creates a separate  
element in the expression vector:

plot(1,1)
mtext(expression(A[1]~B[2],"additional text", "more  
text"),side=3,line=1:3)

(Which results in the reverse order of what this newbie expected.)

> -- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list