I have a problem with expressions. I am trying to create a title where the parameter of interest is displayed as a Greek character. Which parameter is being considered is stored in a character variable. As an example, if I have param <- "alpha" and then do plot(0, 0, main = bquote(Parameter==.(param))) then in the title I get "Parameter = alpha", whereas I want the Greek character alpha. David Scott -- _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics
On Tue, 25 Jan 2011, David Scott wrote:> I have a problem with expressions. I am trying to create a title where the > parameter of interest is displayed as a Greek character. Which parameter is > being considered is stored in a character variable. > > As an example, if I have > > param <- "alpha"param <- as.name("alpha") HTH, Chuck> > and then do > > plot(0, 0, main = bquote(Parameter==.(param))) > > then in the title I get "Parameter = alpha", > whereas I want the Greek character alpha. > > David Scott > > > -- > _________________________________________________________________ > David Scott Department of Statistics > The University of Auckland, PB 92019 > Auckland 1142, NEW ZEALAND > Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 > Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018 > > Director of Consulting, Department of Statistics > > ______________________________________________ > 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. >Charles C. Berry Dept of Family/Preventive Medicine cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
Thanks. Exactly what I wanted. As usual, I played around with all sorts of things to try and get the expression right, but never thought of as.name. David Scott On 25/01/2011 4:32 a.m., Charles C. Berry wrote:> On Tue, 25 Jan 2011, David Scott wrote: > >> I have a problem with expressions. I am trying to create a title where the >> parameter of interest is displayed as a Greek character. Which parameter is >> being considered is stored in a character variable. >> >> As an example, if I have >> >> param<- "alpha" > > param<- as.name("alpha") > > > HTH, > > Chuck >> >> and then do >> >> plot(0, 0, main = bquote(Parameter==.(param))) >> >> then in the title I get "Parameter = alpha", >> whereas I want the Greek character alpha. >> >> David Scott >> >> >> -- >> _________________________________________________________________ >> David Scott Department of Statistics >> The University of Auckland, PB 92019 >> Auckland 1142, NEW ZEALAND >> Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 >> Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018 >> >> Director of Consulting, Department of Statistics >> >> ______________________________________________ >> 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. >> > > Charles C. Berry Dept of Family/Preventive Medicine > cberry at tajo.ucsd.edu UC San Diego > http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 > >-- _________________________________________________________________ David Scott Department of Statistics The University of Auckland, PB 92019 Auckland 1142, NEW ZEALAND Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055 Email: d.scott at auckland.ac.nz, Fax: +64 9 373 7018 Director of Consulting, Department of Statistics