[R] Help with lattice

Nelson, Gary (FWE) Gary.Nelson at state.ma.us
Thu Oct 23 16:37:10 CEST 2008


With R version 2.8.0, I am using the following function to plot loess
lines in each panel of the xyplot:


xyplot(Z~year|labels,group=as.factor(river),xlab="Year",ylab="Age-based
Z", 
	data=data1,scales="free",ylim=c(0,4),xlim=c(1960,2010),
      par.settings = list(superpose.symbol = list(pch =
c(1,2,3,4,5,16,10,6,87,83),cex=0.9,
           col="black")),    
      panel=function (x,y,...){
           panel.loess(x,y,...,span=0.75,degree=1,lwd=1.5,col="black")
           panel.superpose (x,y,...)	
               },
auto.key = list(points = T,title="River",space="right",cex=0.8),
main="Blueback",as.table=T,layout=c(2,2)
)

There are only three data points for one panel, so an error from the
loess function appears in the plot and the point are not graphed.  Would
anyone know how I could stop the loess function from being applied to
data for a particular panel, but still allow to points to be plotted?

Thanks for your help.

Gary Nelson



More information about the R-help mailing list