Haoda,
You need to pass the 'subscripts' argument in your panel function on
to panel.xyplot(): panel.xyplot(x, y, subscripts, ...)
I think you want something like
pvalue[packet.number()]
and not
pvalue[subscripts]
(which values of TRT do the pvalues correspond to?)
By the way, it is best to provide your data as the output of dput().
That way we can just copy and paste it into R.
-Felix
2009/1/5 Haoda Fu <fuhds at yahoo.com.cn>:> Hi -
>
> I am not R expert and I would appreciate your time if you can help me
> about my xyplot question.
>
> I would like to add text (p-value) in a 4 panels xyplot. I thought
> panel = function{} should work but I am not sure where I did it wrong.
>
> The error message from the following code is
> "Argument subscripts is missing with no default values"
>
> xyplot(GLG ~ PD | factor(TRT) , groups = GLG_ind,strip = strip.custom(style
=4),ref = T, as.table=TRUE,data = splitPD, subscripts = TRUE,cex = 2,
> panel = function(x, y, pvalue,subscripts,...){
> panel.xyplot(x,y,...);
> panel.abline(h = 51.95);
> grid.text(paste("p-value =", pvalue[subscripts]), .25, .15,
> gp = gpar(cex = .8))}
> )
>
>
> I really appreciate your time to help me.
>
> Best,
> Haoda
>
>
> Appendix -
>
> Data
>> pvalue
> [1] 0.88313298 0.02224550 0.80000000 0.12663046
>
>> splitPD
> PD TRT GLG GLG_ind
> 1 -8 30 38.5 0
> 2 -81 30 58.6 1
> 4 -33 30 35.0 0
> 5 -18 30 41.1 0
> 6 -45 90 64.3 1
> 8 -39 90 41.9 0
> 9 -45 90 56.2 1
> 10 -98 90 53.6 1
> 11 27 90 46.4 0
> 12 -45 90 74.2 1
> 15 -22 5 56.4 1
> 16 -25 5 63.8 1
> 17 4 5 50.2 0
> 18 -52 30 64.6 1
> 21 -31 60 44.5 0
> 22 -36 5 42.1 0
> 23 -56 5 37.8 0
> 24 -5 5 31.3 0
> 26 -29 5 31.7 0
> 27 -9 5 39.0 0
> 28 -9 5 26.7 0
> 31 -41 30 52.7 1
> 32 -24 30 50.4 0
> 33 -18 30 32.4 0
> 35 -36 30 41.3 0
> 36 -22 30 41.1 0
> 37 -36 90 42.5 0
> 39 -18 90 63.9 1
> 40 -25 60 40.6 0
> 42 -43 60 86.4 1
> 43 -58 60 48.1 0
> 44 -16 60 48.5 0
> 45 -26 60 59.2 1
>
> Code works
> rm(list=ls());
> library(lattice);
> library(grid);
> library(rpart);
> xyplot(GLG ~ PD | factor(TRT) , groups = GLG_ind,strip = strip.custom(style
=4),ref = T, as.table=TRUE,data = splitPD, cex = 2, panel = function(x,
y,...){panel.xyplot(x,y,...); panel.abline(h = 51.95); })
>
> ______________________________________________
> 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.
>
--
Felix Andrews / ???
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8