[R] Help with plotmath

Steve Roberts steve.roberts at man.ac.uk
Thu Jun 10 15:29:07 CEST 2004


No that isn't it I'm afraid - my expression is pasted together from 
various bits and pieces and is at some stage a string variable. I 
needed parse as Brian pointed out....

Thanks anyway,

Steve.

From:           	"Petr Pikal" <petr.pikal at precheza.cz>
To:             	"Steve Roberts" <steve.roberts at man.ac.uk>
Date sent:      	Thu, 10 Jun 2004 13:44:21 +0200
Subject:        	Re: [R] Help with plotmath
Copies to:      	r-help at stat.math.ethz.ch
Priority:       	normal

> Hi
> 
> On 10 Jun 2004 at 12:28, Steve Roberts wrote:
> 
> > There must be a simple answer. I want to plot an expression, 
> > where the expression is held in a string variable. The "obvious"
> > solution along the lines of
> > 
> > ex<-"x^2"
> > plot( c(0,1), c(0,1), main=as.expression(ex) )
> 
> Plotmath example led me to
> 
> ex<-expression(x^2)
> plot( c(0,1), c(0,1), main=(ex) )
> 
> hope it is what you want.
> 
> Cheers
> Petr
> 
> 
> > 
> > gives me the a title x^2 - ie doesn't treat it like an expression. I
> > suspect I don't understand expressions properly. For the real problem
> > I do need to have my expression string in a variable as it is
> > data-dependent. 
> > 
> > Can someone tell me the magic words?
> > 
> > Steve
> >   Dr Steve Roberts 
> >   steve.roberts at man.ac.uk
> > 
> > Senior Lecturer in Medical Statistics,
> > CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161
> > 275 5192 / 0161 276 5785
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> 
> Petr Pikal
> petr.pikal at precheza.cz
> 
> 


  Dr Steve Roberts 
  steve.roberts at man.ac.uk

Senior Lecturer in Medical Statistics,
CMMCH NHS Trust and University of Manchester Biostatistics Group,
0161 275 5192 / 0161 276 5785




More information about the R-help mailing list