Re: [R] plotting mathematical notation and values substitution

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Mon 04 Apr 2005 - 21:39:41 EST

Luca Scrucca <luca@stat.unipg.it> writes:

> Dear R-users,
>
> I'm trying to add a title on a plot with both mathematical notation and
> values substitution. I read the documentation and search the mailing list
> but I was not able to solve my problem. Actually, there is a message by
> Uwe Ligges on June 2003 which addresses a question very close to mine, but
> the code provided doesn't work. The code is the following:
>
> # I add this to let you run the example by copy and paste
> > t1 <- 0.5; len <- 1
> # then
> > plot(1:10,
> main = substitute("Monotonic Multigamma run (" * n == len * ", " *
> theta == t1 * ").", list(len = len, t1 = t1)))
>
> but I got the following:
>
> Error: syntax error

There's a ")" too many, but more importantly, you have the structure

A*B==C*D*E==F*G

Since * has higher precedence than ==, this involves associative use of relational operators (as in 3 < 2 < 1), which is syntactically forbidden. So you need braces as in

A*{B==C}*D*{E==F}*G

or, maybe easier to read, use:

paste(A, B==C, D, E==F, G}

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon Apr 04 21:51:51 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:01 EST