[R] ltext, small lattice question
Troels Ring
tring at gvdnet.dk
Sat Jan 23 12:36:57 CET 2010
Dear friends - I have a dataset of 40 patients in two groups observed on
three occasions. I only want to plot a line
for each patient in the two groups. I use the ltext function to put the
patient number but fail to make lattice understand the numbers as
unique since apparently it starts all over with 1:20 for each panel
instead of respecting my desires to have 1:20 and then 21:40.
I'm on windows vista, R2.9.2
Best wishes
Troels
score <- runif(120,0,100)
pt <- gl(40,3,120)
times <- rep(c(0,3,6),40)
trt <- gl(2,60,120)
ach <- data.frame(score=score,pt=pt,times=times,trt=trt)
library(lattice)
myPanel <- function(x,y,...){
panel.xyplot(x,y,...)
ltext(x-.1,y+1,paste(pt),cex=0.5) }
xyplot(score~times|trt,groups=pt,type=c("p","l"),ach,
panel=myPanel)
--
Troels Ring
Department of nephrology
Aalborg Hospital
Mølleparkvej
phone: +4599326629
Heliosvej 12
9210 Aalborg SØ
98140582
30480176
More information about the R-help
mailing list