[R] Error in model.frame.default

Heike Schmitz schmitzh at uni-bremen.de
Thu Mar 3 16:43:39 CET 2011


Dear R- Community,

to learn i reanalysed some data provided and analysed by Zuur et. al. in 
their book "Mixed effect models and Extensions in Ecology with R". When 
i run the last command i get a warning message i dont understand.


Loyn<- read.table(file = "loyn.txt",header = TRUE)
Loyn$L.AREA<- log10(Loyn$AREA)
fGRAZE <-factor(Loyn$GRAZE)

M0<- lm(ABUND~ L.AREA + fGRAZE, data = Loyn)
summary(M0)

plot(x = Loyn$L.AREA, y = Loyn$ABUND,
     xlab = "Log transformed AREA",
     ylab = "Bird Abundance")

D1<- data.frame(L.AREA= Loyn$L.AREA[Loyn$GRAZE==1], fGraze = "1")
P1<- predict(M0,newdata = D1)

Warning message:
Error in model.frame.default(Terms, newdata, na.action = na.action, xlev 
= object$xlevels) :
   variable lengths differ (found for 'fGRAZE')
In addition: Warning message:
'newdata' had 13 rows but variable(s) found have 56 rows

I hope anyone has an idea.
Thank you in advance.
Heike

-- 
Heike Schmitz- Diaspero
Population Ecology and Evolutionary Ecology Lab, FB2
University of Bremen
Leobener Strasse, Nw2, Room B4050
D-28359 Bremen
Germany
fon ++49-421-218-62937
email: heike.schmitz at uni-bremen.de

http://www.popecol.uni-bremen.de



More information about the R-help mailing list