[R] Catenating strings involving plotmath symbols.

Rolf Turner rolf.turner at xtra.co.nz
Sat May 19 06:52:57 CEST 2012


On 19/05/12 16:31, baptiste auguie wrote:
> Try this,
>
> bquote(.(L1) * .(L2))
>
> HTH,
>
> b.
     Yep!  That works!  Yew Bewdy!!!  Thanks very much.

     cheers,

         Rolf
> 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.



More information about the R-help mailing list