Nest survival error for factor variables- sort.list

Hi All,
I'm new to RMark but have read the manual and have followed the Nest Survival example in Appendix C using the mallard data (which runs fine for me). I am testing for the effects of multiple habitat variables on DSR. Problem is when I include factors as covariates I have this error...
The models run without error when I only use continuous variables. I've tried using dummy variables as in the mallard example as well as having a single column with the various levels of the factor but get the same error either way. My factors are the nesting "PlantType" with 5 levels and "Year" with 2 levels. My code and data structure (not using dummy variables) are below.
Apologies if the answer is obvious but any help would be much appreciated!
Data Structure
I'm new to RMark but have read the manual and have followed the Nest Survival example in Appendix C using the mallard data (which runs fine for me). I am testing for the effects of multiple habitat variables on DSR. Problem is when I include factors as covariates I have this error...
- Code: Select all
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
The models run without error when I only use continuous variables. I've tried using dummy variables as in the mallard example as well as having a single column with the various levels of the factor but get the same error either way. My factors are the nesting "PlantType" with 5 levels and "Year" with 2 levels. My code and data structure (not using dummy variables) are below.
Apologies if the answer is obvious but any help would be much appreciated!
- Code: Select all
run.markdata=function()
{
# 1. A model of constant daily survival rate (DSR) - Null Model
Dot=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~1)))
# 2. DSR varies by year
Year=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~Year)),groups=c("Year"))
# 3. DSR varies by nest height
Hght=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~Height)))
# 4. DSR varies by canopy closure
CanC=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~CanClosure)))
# 5. DSR varies by nest concealment
AVis=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~AvVis)))
# 6. DSR varies by density of cloud points below 1.5m
Dens=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~AvDen1.5)))
# 7. DSR varies by number of cloud points at nest height
PntH=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~PointNest)))
# 8. DSR varies by skew of cloud points
Skew=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~Skew)))
# 9. DSR varies by type of nesting plant
PTyp=mark(markdata,nocc=156,model="Nest",model.parameters=list(S=list(formula=~PlantType)),groups=c("PlantType"))
return(collect.models() )
}
markdataresults=run.markdata()
Data Structure
- Code: Select all
$ ID : chr "/*1*/" "/*11*/" "/*12*/" "/*15*/" ...
$ FirstFound : num 24 26 26 34 56 60 64 85 85 85 ...
$ LastPresent: num 50 46 47 60 58 65 89 102 97 92 ...
$ LastChecked: num 50 46 47 60 58 65 89 102 97 92 ...
$ Fate : num 0 0 0 0 0 0 0 0 0 0 ...
$ Freq : num 1 1 1 1 1 1 1 1 1 1 ...
$ Year : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
$ Height : num 24 68 74 75 40 159 62 155 33 147 ...
$ CanClosure : num 56.74 3.16 27.16 45.05 18.76 ...
$ AvVis : num 11.38 3.79 18.87 17.29 67.14 ...
$ AvDen1.5 : num 14.7 12.8 12.5 13.1 12.7 ...
$ PointNest : num 215572 98003 503070 615239 293852 ...
$ Skew : num 2.26 1.38 1.63 2.02 1.77 ...
$ PlantType : Factor w/ 5 levels "Bra","Gor","Gra",..: 4 5 5 2 2 2 1 5 4 5 ...