Skip to content
Back to formatted view

Raw Message

Message-ID: <CANLFJPqmFw_mdoh3Ynczr=jdpw8GLfYAbVeQ3ubdh8kYdxVgmA@mail.gmail.com>
Date: 2012-05-19T04:31:55Z
From: Baptiste Auguie
Subject: Catenating strings involving plotmath symbols.
In-Reply-To: <4FB71EE6.8060104@xtra.co.nz>

Try this,

bquote(.(L1) * .(L2))

HTH,

b.

On 19 May 2012 16:17, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
>
> In the context in which I am actually working it is necessary for
> me to build parts of a text string to place on a plot in two separate
> stages.
>
> The following toy example illustrates what I am trying to do:
>
> L1 <- substitute(list(paste("Bias in ", gamma,", ")))
> L2 <- substitute(list(beta==b0),list(b0=300))
>
> plot(1:10,main=L1) # Works fine.
> plot(1:10,main=L2) # Works fine.
>
> But what I want is the catenation of the strings contained in L1 and L2.
> I thought that I might just be able to catenate them using c(), as in
>
> plot(1:10,main=c(L1,L2))
>
> but this just gives me the "L1" title, and L2 gets ignored.
>
> Is there any way to accomplish my goal?
>
> (Please don't tell me how to build a single string to use as a title;
> I know how to do that. ?I need to be able to build two separate
> strings and then combine them somehow.)
>
> It seems to me that it should be do-able, but I have no idea where
> or how to look for the appropriate incantation. ?Googling around,
> I found lots of stuff on how to catenate vectors or paste together
> "ordinary" text strings, but nothing on how to catenate mathematical
> expressions.
>
> Can anyone help me out?
>
> ? ?cheers,
>
> ? ? ? ?Rolf Turner
>
> ______________________________________________
> 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.