[R] Plotmath expression

Christos Hatzis christos at nuverabio.com
Tue Oct 24 18:36:49 CEST 2006


Excellent! Thank you.
I am reading now your article in R-News (2/3 p.32-34) to understand the
logic behind substitute in the expression.

-Christos 

-----Original Message-----
From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de] 
Sent: Tuesday, October 24, 2006 12:27 PM
To: christos at nuverabio.com
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Plotmath expression



Christos Hatzis wrote:
> Hello,
>  
> I've been trying to plot a subscript in a text formula using plotmath 
> but I haven't been able to do so.
>  
> In my example below I would like the text label to show X[min] = 10.1 
> +/- 5.5
> 
> Here is the code:
> 
> ll <- c(x=10.1, sde=5.5)
> plot(1:10)
> text(x=9, y=2, pos=2, expression(paste(X[min], "=", paste(ll,
> collapse="+/-"))))


  plot(1:10)
  text(x=9, y=2, pos=2, substitute(X[min] == x %+-% sde, as.list(ll)))

Uwe Ligges

> This works fine up to the inner paste call that collapses the vector
values.
> I also tried assigning the value of the inner paste to a variable and 
> then use it inside the expression but that did not work either:
> 
> ll.txt <- paste(ll, collapse="+/-")
> text(x=9, y=2, pos=2, expression(paste(X[min], "=", ll.txt)))
> 
> Any help is much appreciated.
> 
> Thanks.
>  
> Christos Hatzis, Ph.D.
> Nuvera Biosciences, Inc.
> 400 West Cummings Park
> Suite 5350
> Woburn, MA 01801
> Tel: 781-938-3830
> www.nuverabio.com
> 
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list