Thanks for the example. On Thu, Oct 11, 2012 at 7:24 PM, William Dunlap [via R] < ml-node+s789695n4645934...@n4.nabble.com> wrote:
> I think that bquote, with its .() operator, suffices for [almost?] any > single title; > don't bother fiddling with expression(), substitute(), or parse(). (You > can make > those work in many situations, but if you stick with just bquote then you > can > spend your time on the title itself.) > > E.g., > hist(new, main=bquote("Heart Attack (" * bar(X)==.(mean(new)) * ")")) > or, if you want to limit the number of digits after the decimal point, > hist(new, main=bquote("Heart Attack (" * bar(X)==.(round(mean(new),1)) * > ")")) > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > > > > -----Original Message----- > > From: [hidden > > email]<http://user/SendEmail.jtp?type=node&node=4645934&i=0>[mailto:[hidden > email] <http://user/SendEmail.jtp?type=node&node=4645934&i=1>] On Behalf > > Of 1Rnwb > > Sent: Thursday, October 11, 2012 2:32 PM > > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=4645934&i=2> > > Subject: [R] characters, mathematical expressions and computed values > > > > Hello, > > > > I have to add "Age (bar(x)=14.3) as a title on a chart. I am unable to > get > > this to working. I have tried bquote, substitute and expression, but > they > > are only doing a part of the job. > > > > new<- > > c(14.3, 18.5, 18.1, 17.7, 18, 15.9, 19.6, 17.3, 17.8, 17.5, 15.4, > > 16.3, 15, 17.1, 17.1, 16.4, 15.2, 16.7, 16.7, 16.9, 14.5, 16.6, > > 15.8, 15.2, 16.2, 15.6, 15, 17.1, 16.7, 15.6, 15, 15.8, 16.8, > > 17, 15.2, 15.8, 15.7, 14.7, 17.3, 14.9, 16.8, 14.6, 19.3, 15.3, > > 14.7, 13.3, 16.5, 16, 14.2, 16.1, 15.2, 13.4, 17.7, 15.5, 14.5, > > 15.7, 13.6, 14.1, 20, 17.2, 16.5, 14.3, 13.7, 14.7, 15.4, 13.6, > > 17, 17.3, 15.4, 15.5, 16.6, 15.8, 15.7, 14.7, 14.2, 14.2, 14, > > 14.2, 19.1, 17.2, 18.3, 13.9, 16, 15.9, 14.9, 14.6, 15.9, 12.2, > > 14.1, 12, 12.8, 17.1, 17, 15, 15.8, 15.9, 16.1, 18, 14.7, 18.9 > > ) > > hist(new, xlab='30-day Death Rate',xlim=c(7,22),main=expression("Heart > > Attack(" * bar(X) * ")=" * > > mean(new))) > > > > I would appreciate any pointers on getting this correct. > > Thanks > > > > > > > > -- > > View this message in context: > http://r.789695.n4.nabble.com/characters-mathematical- > > expressions-and-computed-values-tp4645916.html > > Sent from the R help mailing list archive at Nabble.com. > > > > ______________________________________________ > > [hidden email] > > <http://user/SendEmail.jtp?type=node&node=4645934&i=3>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. > > ______________________________________________ > [hidden email] <http://user/SendEmail.jtp?type=node&node=4645934&i=4>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. > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://r.789695.n4.nabble.com/characters-mathematical-expressions-and-computed-values-tp4645916p4645934.html > To unsubscribe from characters, mathematical expressions and computed > values, click > here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4645916&code=c2JwdXJvaGl0QGdtYWlsLmNvbXw0NjQ1OTE2fDU4ODg0MTYwOQ==> > . > NAML<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://r.789695.n4.nabble.com/characters-mathematical-expressions-and-computed-values-tp4645916p4646003.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ R-help@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.