From: Deepayan Sarkar <deepayan_at_stat.wisc.edu>

Date: Sat 23 Apr 2005 - 03:03:50 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Apr 23 03:04:50 2005

Date: Sat 23 Apr 2005 - 03:03:50 EST

On Friday 22 April 2005 10:12, David Orme wrote:

*> Hi,
**>
*

> I've got a lattice xyplot and I want to superimpose correlation

*> coefficients and p values on each panel. I've been trying to get this
**> to work using something of the form:
**>
**> x <- rnorm(400)
**> y <- rnorm(400)
**> a <- gl(4, 100)
**>
**> xyplot(y~x | a,
**> panel=function(x,y, ...){
**> panel.xyplot(x,y, ...)
**> curr.cor <- cor.test(x,y)
**> crho <- round(curr.cor$estimate,2)
**> cpv <- format.pval(curr.cor$p.value, eps = 0.01, digits=2)
**> exprrho <- substitute(rho == crho, list(crho=crho))
**> exprpv <- substitute(italic(p) == cpv, list(cpv=cpv))
**> panel.text(-2, 2, label=exprrho)
**> panel.text(2, 2, label=exprpv)
**> })
**>
**> The two expressions (expprho and exprpv) plot as expected on a normal
**> text() call but in the panels, all that appears at the coordinates is
**> "==". This is the first element in exprrho; other than that, I can't
**> figure out what is going wrong.
**>
**> Any suggestions?
*

I believe this came up a few days back.

> exprrho <- substitute(rho == crho, list(crho=.12))

*> is.expression(exprrho)
***[1] FALSE
**
i.e., the label you are using is not an expression. The 'panel.text' you have
didn't take this possibility into account (unlike 'text').

The good news is that this has been fixed in R 2.1.0.

Deepayan

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Apr 23 03:04:50 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:22 EST
*