[R] 2 functions in xyplot
Paul Hiemstra
p.hiemstra at geo.uu.nl
Fri Nov 20 10:06:05 CET 2009
RICHARD M. HEIBERGER wrote:
> "Unexpected symbol" often means missing punctuation.
>
> In this case, it looks like
>
> panel=function(){panel.xyplot(Kalibrierung$Spannung,Kalibrierung
> $Magnetfeld)panel.abline(reg=test)}
>
> this argument is missing a semi-colon ";" before "panel.abline".
>
> panel=function(){panel.xyplot(Kalibrierung$Spannung,Kalibrierung
> $Magnetfeld); panel.abline(reg=test)}
>
> ______________________________________________
> R-help at r-project.org 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.
>
in addition to Richard:
I would try to write out the function over multiple lines:
panel=function(){
panel.xyplot(Kalibrierung$Spannung,Kalibrierung$Magnetfeld)
panel.abline(reg=test)}
solven the problem you had, as would the semicolon, but in my opinion it
make the command more readable. You can also use '...' in the panel
function:
panel=function(...){
panel.xyplot(...)
panel.abline(reg=test)}
I like this because I don't have think about what to pass on to
panel.xyplot.
hope this helps,
Paul
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul
More information about the R-help
mailing list