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@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.