Hello,
after a long night I don't find any mistake anymore in my xyplot and it
doesn't work. I want to make a scatterplot with regression line.
Each of it alone is possible but both arguments together are not
working:
"unexpected symbol...
test<-lm(Magnetfeld~Spannung,data=Kalibrierung)
kalib<-xyplot(Magnetfeld~Spannung,data=Kalibrierung,xlab=list(label="Spannung (mV)",fontsize=20),ylab=list(label="Magnetfeld (T)",fontsize=20),scales=list(cex=1.5),
panel=function(){panel.xyplot(Kalibrierung$Spannung,Kalibrierung
$Magnetfeld)panel.abline(reg=test)})
I tried different arguments in "function()" and the "panel...()" but
without sucess. It's always a problem with two plots in one.
But I need it, it's very important for other cases as well
thanks
Markus
2 functions in xyplot
3 messages · Markus Häge, Richard M. Heiberger, Paul Hiemstra
"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)}
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