[R] plotmath: how to use greek symbols in expression(integral(f(tau)*dtau, 0, t))?

David Winsemius dwinsemius at comcast.net
Mon Oct 4 17:33:54 CEST 2010


On Oct 4, 2010, at 10:11 AM, Thomas Stewart wrote:

> Try
>
> expression(paste(integral(),"f(",tau,") d",tau,sep="")))
>
> it works for me.

It does "work" (albeit without properly including the requested limits  
of integrations), but if it is used as a teaching example, it will  
obscure the syntax of plotmath expressions. A simple version that gets  
the same result is:

  expression(integral()*f(tau)*d*tau))

Plotmath expressions are parsed from unquoted text with proper non- 
printing separators being "~" for space and "*" for juxtaposition. The  
plotmath paste() is not really the same as the base function paste(),  
despite identical names and its main value is as a method for allowing  
commas to also be used as separators. Frankly I'm a bit surprised you  
got away with adding the undocumented sep="" argument. My reading of  
the help page for plotmath would have lead me to predict that the text  
'sep=""' should appear in the output. Instead the "sep=" is ignored  
and the text string is appended to the end of the expression

Try for instance:

plot(1,1, main=expression(paste(a,b,c,d, sep="-") )  )

-- 
David.

>
> -tgs
>
> On Mon, Oct 4, 2010 at 9:25 AM, Czerminski, Ryszard <
> Ryszard.Czerminski at astrazeneca.com> wrote:
>
>> I would like to use greek "tau" as a symbol of variable to integrate
>> over in plotmath
>>
>> expression(integral(f(tau)*dtau, 0,t))
>>
>> but nothing seems to work. I tried d{\tau}, d\tau, etc.,
>> without any success
>>
>> Is it possible? How can I accomplish this?
>>
>> Best regards,
>> Ryszard
>>
>>
>> --------------------------------------------------------------------------
>> Confidentiality Notice: This message is private and may ... 
>> {{dropped:11}}
>>
>> ______________________________________________
>> 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.
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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