[R] Pasting R code lines into labels

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu Jun 6 17:54:28 CEST 2019


The well known deparse(substitute(...)) construction.

plot(1:9, main = paste("plot of",deparse(substitute(y <- x^2))))

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, Jun 6, 2019 at 8:19 AM Nick Wray via R-help <r-help using r-project.org>
wrote:

> Is there any way of taking a line of r code (eg y<-x^2) and pasting that
> line of code, as is, into a label, so that for example I could then have a
> plot label "Plot of y<-x^2"?
>
> Thanks Nick Wray
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list