This example is from "The R Book" by Michael J. Crawley.

d=read.table( 
"http://www.bio.ic.ac.uk/research/mjcraw/therbook/data/diminish.txt";
,header=TRUE)
p=qplot(xv,yv,data=d); p
m1=lm(yv~xv,data=d)
p1=p + geom_abline(intercept=coefficients(m1)[1],
slope=coefficients(m1)[2] ); p1
m2=lm(yv~xv + I(xv^2),data=d)
x=seq(min(d$xv),max(d$xv),length=100)
p1 + geom_line(aes(x=x,y=predict(m2,list(xv=x))), color="red")

I can run the above codes without any problems in an older version of
R(R 2.10.1). But if I run the codes in a newer version of R(R 2.15, R
2.14), I got the error:
> p1 + geom_line(aes(x=x,y=predict(m2,list(xv=x))), color="red")
Error in data.frame(evaled, PANEL = data$PANEL) :
  arguments imply differing number of rows: 100, 18

I am confused about this error. Could someone help me? Thank you so much!

Debbie

______________________________________________
R-help@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.

Reply via email to