[R] lattice
R. Heberto Ghezzo
heberto at meakins.lan.mcgill.ca
Thu Aug 30 16:47:11 CEST 2001
Hello. I know that lattice is still in beta beta but. . .
Nick Ellis wrote to S-news with an example of 'trellis' with several
lines in each panel.
df<-expand.grid(fac1=letters[1:2],x=seq(0,1,0.1),fac2=LETTERS[1:4])
df$y<-df$x*codes(df$fac1)+codes(df$fac2)*df$x^2+rnorm(nrow(df))/3
xyplot(y ~ x | fac2,
groups=fac1,
data=df,
panel=function(x,y,subscripts,groups){
panel.superpose(x,y,subscripts,groups)
for(g in as.character(unique(groups[subscripts]))) {
sub <- groups[subscripts] == g
fit <- lm(y~x+I(x^2),subset=sub)
ord <- order(x[sub])
lines(x[sub][ord],fitted(fit)[ord])
}
}
)
if I run this in R 1.3 after library(grid), library(lattice) I get the 4
panels with the 2 sets of points in different colors in each panel, but
not the panel function, i.e. the fitted quadratics, 2 per panel. Is
this because lattice is still beta? or the construccion of the panel
function is different in lattice?
I am using R 1.3 on Win98
Thanks for any help.
.
R. Heberto Ghezzo Ph.D.
Meakins-Christie Labs
McGill University
3621 Rue Saint Urbain
Montreal Que H2X-2P2
Canada
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list