Why not use the more simple
xyplot(total.fat~x|variable,groups=Group,
data=tmp1,type=c("p","r"))
???
See ?panel.xyplot and especially the type argument of that panel function.
Best regards
Frede Aakmann T?gersen
Scientist
UNIVERSITY OF AARHUS
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology
Blichers All? 20, P.O. BOX 50
DK-8830 Tjele
Phone: +45 8999 1900
Direct: +45 8999 1878
E-mail: FredeA.Togersen at agrsci.dk
Web: http://www.agrsci.org
This email may contain information that is confidential.
Any use or publication of this email without written permission from Faculty of
Agricultural Sciences is not allowed.
If you are not the intended recipient, please notify Faculty of Agricultural
Sciences immediately and delete this email.
> -----Oprindelig meddelelse-----
> Fra: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] P? vegne af Ross Darnell
> Sendt: 10. september 2007 07:55
> Til: r-help at stat.math.ethz.ch
> Emne: [R] lattice panel.lmline problem
>
> I am wanting to generate panels showing scatterplots with the
> linear fitted line for two groups within each panel superimposed.
>
> I have two conditioning factors, "variable" and "Group"
and I
> want separate panels for each level of "variable"
>
> with different symbols and "lmline"s for each level of
> "Group". However all observations for a group are missing for
> some variables so I would still like the points and lmline
> for the observed group plotted for that variable(panel).
>
>
>
> My attempt is
>
>
>
> print(xyplot(total.fat~x|variable,data=tmp1,subscripts=TRUE,
>
>
>
scales=list(x=list(relation="free")),xlab="",groups=Group,
>
> panel=function(x,y,subscripts,...){
>
> panel.superpose(x,y,subscripts,...)
>
> if(length(x[subscripts])!=0)
>
>
>
{panel.superpose(x,y,panel.groups="panel.lmline",subscripts,...)}}))
>
>
>
> Which gives an error
>
>
>
> Error in lm.fit(x, y, offset = offset, singular.ok =
> singular.ok, ...) :
>
>
> 0 (non-NA) cases
>
> >
>
>
>
> Which occurs when the first panel with all values for one
> group are missing.
>
> The same error is returned if I replace the last line without the
"if"
> statement which obviously means it's ignored.
>
>
>
> Of course I may be taking the wrong tack completely to get
> the result I need. Any advice would be appreciated
>
>
>
>
>
> Ross Darnell
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>