Nest survival 'error in dataframe'

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

Nest survival 'error in dataframe'

Postby jwarren » Thu Nov 11, 2010 3:09 pm

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.
jwarren
 
Posts: 11
Joined: Tue Nov 25, 2008 11:33 am
Location: Lakeview, Montana

Re: Nest survival 'error in dataframe'

Postby jlaake » Thu Nov 11, 2010 8:34 pm

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
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Nest survival 'error in dataframe'

Postby jwarren » Thu Nov 11, 2010 9:05 pm

That worked perfectly, thanks!

Jeff
jwarren
 
Posts: 11
Joined: Tue Nov 25, 2008 11:33 am
Location: Lakeview, Montana


Return to RMark

Who is online

Users browsing this forum: No registered users and 0 guests