Ingeborg Schmidt
2009-Jan-04 11:57 UTC
[R] Combining greek letters with the contents of variables
Dear r-help list,
I am trying to combine a greek letter lambda with the contents of a variable v
in the title of a plot. However, it seems that having v inside the expression()
function causes it not to be evaluated, on the other hand having
expression(lambda) inside something else like paste causes it to be evaluated to
a string. Here is an example of what I want to do:
title(main=expression("Value of "*Lambda*paste(" =
",v,sep="")))
Is there any solution for this?
Cheers,
Ingeborg Schmidt
[[alternative HTML version deleted]]
Uwe Ligges
2009-Jan-04 16:17 UTC
[R] Combining greek letters with the contents of variables
I feel this becomes a frequently asked question, hence I tried Google and typed "R main expression greek" --- and got an answer: https://stat.ethz.ch/pipermail/r-help/2006-July/109934.html Uwe Ligges Ingeborg Schmidt wrote:> Dear r-help list, > I am trying to combine a greek letter lambda with the contents of a variable v in the title of a plot. However, it seems that having v inside the expression() function causes it not to be evaluated, on the other hand having expression(lambda) inside something else like paste causes it to be evaluated to a string. Here is an example of what I want to do: > title(main=expression("Value of "*Lambda*paste(" = ",v,sep=""))) > Is there any solution for this? > > Cheers, > Ingeborg Schmidt > > > > > [[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.
Gabor Grothendieck
2009-Jan-04 16:36 UTC
[R] Combining greek letters with the contents of variables
The paste in that answer could be eliminated using ~ :
plot(1:10, main= bquote("Results for" ~ pi == .(pi)))
On Sun, Jan 4, 2009 at 11:17 AM, Uwe Ligges
<ligges at statistik.tu-dortmund.de> wrote:> I feel this becomes a frequently asked question, hence I tried Google and
> typed "R main expression greek" --- and got an answer:
> https://stat.ethz.ch/pipermail/r-help/2006-July/109934.html
>
> Uwe Ligges
>
>
>
>
> Ingeborg Schmidt wrote:
>>
>> Dear r-help list,
>> I am trying to combine a greek letter lambda with the contents of a
>> variable v in the title of a plot. However, it seems that having v
inside
>> the expression() function causes it not to be evaluated, on the other
hand
>> having expression(lambda) inside something else like paste causes it to
be
>> evaluated to a string. Here is an example of what I want to do:
>> title(main=expression("Value of "*Lambda*paste(" =
",v,sep="")))
>> Is there any solution for this?
>>
>> Cheers,
>> Ingeborg Schmidt
>>
>>
>>
>> [[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.
>
> ______________________________________________
> 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.
>