You can use bquote (see ?bquote or the example in ?plotmath using bquote).
Here you go,
pvalue <- 0.3
legend("bottom", fill=c("red","blue"), legend=c(bquote(p==.(pvalue)),
expression(p==0.50)), bty="n")
Med venlig hilsen
Frede Aakmann Tøgersen
> -----Oprindelig meddelelse-----
> Fra: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] På vegne af stat stat
> Sendt: 26. september 2007 00:13
> Til: [EMAIL PROTECTED]
> Emne: [R] Legend
>
> I have following syntax for putting a legend :
>
> legend("bottom", fill=c("red","blue"),
> legend=expression(p==0.30, p==0.50), bty="n")
>
> However what I want is that : the value "0.30" should be a
> value of a variable instead of a constant, so that I can put
> the name of this variable and in legend it's value will be
> displayed. Can anyone tell me how to do that?
>
> Regards,
>
>
> thanks in advance
>
> ---------------------------------
> Why delete messages? Unlimited storage is just a click away.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] 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.
>
______________________________________________
[email protected] 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.