Page 1 of 1

Nest survival 'error in dataframe'

PostPosted: Thu Nov 11, 2010 3:09 pm
by jwarren
I'm analyzing 5 years of nest data and am having difficulty with factor variables. When I run a model based on year (each year treated as a vector of 0s and 1s similar to the example in the RMark mallard example with habitat types) I get the following error:
"Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 296, 0"

from the following code (based on the mallard example):
year<-mark(lesc, nocc=64, model="Nest", model.parameters=list(S=list(formula=~y2007 + y2008 + y2009 + y2010)),
groups=c("y2007","y2008","y2009","y2010"))

Year 2006 is indicated when years 2007-10 are 0s. I've looked the error up online and it seems to be for determining if a dataframe has differing vector lengths among columns. Each of the year factor variables has the proper number (296) of rows in my dataframe. Any help would be greatly appreciated.

Re: Nest survival 'error in dataframe'

PostPosted: Thu Nov 11, 2010 8:34 pm
by jlaake
Jeff-

Can't tell you exactly what is causing the error but if you have y2007, etc coded as individual covariates with 0/1 then they should be read in as numeric and they are dummy variables for the factor levels and are not factor variables. In that case they can be used in the formula directly and not as grouping variables. Try dropping the groups= component and see if it works. Jay Rotella wrote the mallard example, so I don't really remember what it contains. If my suggestion doesn't work let me know and I'll look at it further.

-jeff

Re: Nest survival 'error in dataframe'

PostPosted: Thu Nov 11, 2010 9:05 pm
by jwarren
That worked perfectly, thanks!

Jeff