# Re: [R] expression + paste + arguments + ...

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Fri 30 Jul 2004 - 17:00:51 EST

ivo_welch-rstat8783@mailblocks.com wrote:

>
> dear R wizards: I would like to write a function that roughly places
> the equivalent of the following latex text into the current plot:
>
> \newcommand{ \placesigma }[4]{ \put(\#1,\#2){ \sigma_{A , #3} = #4 }

???
You are "just" defining a new LaTeX command ... nothing will be printed in LaTeX.

Instead of using \put, you can specify coordinates as usual in R using text(), title() or mtext().
Instead of "\sigma_{A , #3} = #4", you can use

substitute(sigma[v3] == v4, list(v3 = paste("A,",v3), v4 = v4))

plot(1:10)
v3 <- 99
v4 <- 55
text(4, 1, label = substitute(sigma[v3] == v4,

                  list(v3 = paste("A,",v3), v4 = v4)))



See also ?plotmath and the R Help Desk Column in R News 2 (3).

Uwe Ligges

> I cannot figure out how to do this. I know I have to use a function
> that uses expressions in a text() invoke. But passing arguments and
> nesting strings and expressions has so far not worked for me. I hope
> this is an obvious question---if not, please just tell me and I can give
> up. help appreciated.
>
> sincerely,
>
> /iaw
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help