Christine: You need to spend some time with an R tutorial ("An Intro to R" ships with R, but there are many on the web) where function arguments are explained more fully. That should go a long way to clearing up your "stupidity."
Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Mon, Sep 14, 2015 at 6:27 AM, Michael Dewey <li...@dewey.myzen.co.uk> wrote: > Dear Christine > > The point of the ellipsis ... is to pass into the interior function any > other parameters which were supplied to the exterior function. If you know > for sure that there will never, never, never be such additional parameters > then you can leave it out but that is a bit like not using a seat belt on > the basis that you do not plan to have an accident. > > > On 14/09/2015 10:30, Christine Lee via R-help wrote: >> >> Thanks, Duncan, I am confused by the function(x,y, ...) and >> panel.xyplot(x,y,...). Is this a must to put in "..."? I knew this may be a >> stupid question. I am sorry. Christine >> >> >> Duncan Mackay <dulca...@bigpond.com> 於 2015年09月14日 (週一) 3:56 PM 寫道﹕ >> >> >> Hi >> >> As Bert has intimated there was a misspelling in panel.abline >> >> To get points as well you need the appropriate arguments for a panel >> function otherwise you would only get a line. >> You only had a function for a line in panel function so adding >> panel.xyplot >> will give you points as well. >> >> >> xyplot(DI~Date1|Station, data=Raw, >> groups = culr, >> par.settings = list(strip.background = list(col = "transparent"), >> superpose.symbol = list(cex = rep(2, 2), >> >> col=c("grey","black"), >> pch = rep(16,2))), >> type="p", >> xlab=list("Month",cex=1.5), >> ylab=list("Dispersion index",cex=1.5), >> index.cond=list(c(1,2,3,4)), >> auto.key = T, >> layout=c(4,1), >> panel = function(x, y, ...){ >> >> panel.xyplot(x,y, ...) >> panel.abline(h=1,lty=2,lwd=3) >> } >> >> ) >> >> Regards >> >> Duncan >> >> Duncan Mackay >> Department of Agronomy and Soil Science >> University of New England >> Armidale NSW 2351 >> Email: home: mac...@northnet.com.au >> >> -----Original Message----- >> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Christine >> Lee via R-help >> Sent: Monday, 14 September 2015 13:43 >> To: r-help@r-project.org >> Subject: [R] adding a line across plots in xy plot with panel.abline >> >> Dear all, >> >> I want to draw a line at DI=1 across all four graphs in the xy plot, I >> have >> used panel.abline, but I failed to do so, does any one has an idea of what >> has went wrong? >> >> structure(list(Date = structure(c(6L, 7L, 2L, 4L, 13L, 17L, 5L, >> 12L, 4L, 11L, 14L, 9L, 7L, 2L, 4L, 13L, 10L, 17L, 5L, 12L, 8L, >> 4L, 11L, 14L, 9L, 16L, 15L, 3L, 10L, 1L, 17L, 5L, 12L, 8L, 4L, >> 11L, 14L, 12L, 8L, 4L, 11L, 14L), .Label = c("1/10", "1/11", >> "11/11", "12/11", "13/10", "19/9", "2/10", "2/11", "20/9", "23/9", >> "26/11", "29/10", "29/11", "30/11", "31/10", "4/10", "6/10"), class = >> "factor"), >> Year = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, >> 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, >> 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >> 2L, 2L), .Label = c("Y2002", "Y2014"), class = "factor"), >> Station = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, >> 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, >> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, >> 4L, 4L, 4L), .Label = c("E", "F", "H", "I"), class = "factor"), >> DI = c(13.4, 7, 12.6, 12.6, 5.2, 2.2, 1, 1, 1.2, 0.8, 2.3, >> 3.8, 5.4, 4.6, 5, 3.2, 3.1, 8.7, 2.1, 2.7, 4.9, 4, 2.2, 5.3, >> 5.6, 4.8, 4, 8.6, 1.9, 2.9, 5.9, 2.6, 8.9, 4, 13.5, 15.3, >> 12.8, 3.4, 4.7, 1.7, 0.9, 1.7), Date1 = structure(c(16697, >> 16710, 16740, 16751, 16768, 16714, 16721, 16737, 16751, 16765, >> 16769, 16698, 16710, 16740, 16751, 16768, 16701, 16714, 16721, >> 16737, 16741, 16751, 16765, 16769, 16698, 16712, 16739, 16750, >> 16701, 16709, 16714, 16721, 16737, 16741, 16751, 16765, 16769, >> 16737, 16741, 16751, 16765, 16769), class = "Date")), .Names = >> c("Date", >> >> "Year", "Station", "DI", "Date1"), row.names = c(NA, -42L), class = >> "data.frame") >> Raw$Date1<-as.Date(Raw$Date,"%d/%m") >> culr<-ifelse(Raw$Year=="Y2002","Year 2002","Year 2014") >> library(lattice) >> xyplot(DI~Date1|Station, data=Raw, >> groups = culr, >> par.settings = list(strip.background = list(col = "transparent"), >> superpose.symbol = list(cex = rep(2, 2), >> >> col=c("grey","black"), >> pch = rep(16,2))), >> type="p", >> xlab=list("Month",cex=1.5), >> ylab=list("Dispersion index",cex=1.5), >> index.cond=list(c(1,2,3,4)), >> auto.key = T, >> layout=c(4,1), >> panel=function(Date1,DI){ >> panel.labline(h=1,lty=2,lwd=3) >> }) >> >> Many thanks. >> >> Regards, >> Christine >> >> >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. >> >> >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. >> > > -- > Michael > http://www.dewey.myzen.co.uk/home.html > > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.