[R] Question about adding text to xYplot(Hmisc)

Wen Huang whuang.ustc at gmail.com
Fri May 30 05:41:20 CEST 2008


Hello,

I have been trying to make a graph that have error bars and text at  
specific position.

I used the following code from the help file of xYplot(Hmisc) as an  
example except I add a myPanel function, which is just supposed to add  
letters from the alphabet at the position aligned at y = 3.

It constantly gives me error:
"Error using packet 1 argument "subscripts" is missing, with no  
default".

The same code can work with xyplot from the lattice package (does not  
have error bar though).

Can somebody kindly offer some help?

Thanks,
Wen
dfr <- expand.grid(month=1:12, continent=c('Europe','USA'),
                    sex=c('female','male'))
set.seed(1)
dfr <- upData(dfr,
               y=month/10 + 1*(sex=='female') +  
2*(continent=='Europe') +
                 runif(48,-.15,.15),
               lower=y - runif(48,.05,.15),
               upper=y + runif(48,.05,.15))

myPanel <- function(x, y, subscripts, ...) {
  panel.xYplot(x, y, ...)
  ltext(x, 3, letters[subscripts], cex=0.5)
  }
xYplot(Cbind(y,lower,upper) ~ month,subset=sex=='male' &  
continent=='USA',
        data=dfr, panel = myPanel)



More information about the R-help mailing list