[R] evaluate variable within expression - how?
Peter Ehlers
ehlers at ucalgary.ca
Sun Feb 14 18:07:02 CET 2010
Try
text(.5, .5, bquote(bold(.(myText))))
-Peter Ehlers
Mark Heckmann wrote:
> # I want to plot bold text. The text should depend on a variable
> containing a character string.
>
> plot.new()
> text(.5, .5, expression(bold("Some text")))
>
> # now I would like to do the same replacing "some text" by a variable.
>
> plot.new()
> myText <- "some text"
> text(.5, .5, expression(bold(myText)))
>
> # This obviouyls does not work.
> # How can I combine substitute, parse, paste etc. do get what I want?
> # And could someone add a brief explanation what happens, as I find
> parse, expression, deparse, substitute etc. not easy to understand.
>
> Thanks,
> Mark
>
> –––––––––––––––––––––––––––––––––––––––
> Mark Heckmann
> Dipl. Wirt.-Ing. cand. Psych.
> Vorstraße 93 B01
> 28359 Bremen
> Blog: www.markheckmann.de
> R-Blog: http://ryouready.wordpress.com
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> 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.
--
Peter Ehlers
University of Calgary
More information about the R-help
mailing list