RMark Error: Capture history length is not constant...Help!

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

RMark Error: Capture history length is not constant...Help!

Postby su2283 » Thu Oct 29, 2009 4:25 pm

Hi,

I am just starting with RMark and am getting the following error when trying to run a Burnham model for this data (survA):

> model1.Burnham=process.data(survA,,model="Burnham")
Error in process.data(survA, , model = "Burnham") :
Capture history length is not constant. ch must be a character string
row numbers with incorrect ch length 1,2,3,4,5,6,7,9,10,11,12,13,14,15$"

So, basically all my rows have incorrect length? I cannot see where I am going wrong, to mee it looks ok.

I put the file together in Excel, saves as tab delimited file.
I have copied the text here, so you can help me fix the error in RMark!.

variables:
> class(survA$ch)
[1] "character"
> class(survA$sex)
[1] "factor"
> class(survA$tag)
[1] "character"
> class(survA$age.tagged)
[1] "factor"

Data:
-100 animals (A00-A99) followed for 12 years
-nocc=11
-total ch=22

survA*.txt

ch tag age.tagged sex
1010101000000000000010 A00 J 1
1000101000000000000000 A01 J 1
1010101000001010000000 A02 J 0
1010101000001000000000 A03 A 1
0100000000000000000000 A04 P 0
1010101010100000000000 A05 A 1
0100000000000000000000 A06 P 1
1010100000000000000000 A07 P 0
1001000000000000000000 A08 P 1
0100000000000000000000 A09 P 1
0100000000000000000000 A10 P 1
1001000000000000000000 A11 P 0
0100000000000000000000 A12 P 0
0100000000000000000000 A13 P 1
1010101000000000000000 A14 P 1
0100000000000000000000 A15 P 0
1010101010101000000000 A16 A 0
1001000000000000000000 A17 P 0
1010101010101000000000 A18 A 1
1010101010101000101000 A19 P 0
1010101010000000000000 A20 A 1
0100000000000000000000 A21 P 1
1001000000000000000000 A22 P 0
1010101010000000000000 A23 A 1
1010000000000000000000 A24 P 0
1010101010100000000000 A25 A 1
0100000000000000000000 A26 P 1
1010101010101010000000 A27 A 1
1010101010100010000000 A28 P 0
1010101000000000000000 A29 A 1
1010000000000000000000 A30 P 0
1010000000000000000000 A31 A 1
0100000000000000000000 A32 P 0
1010101000101010000000 A33 A 1
1001000000000000000000 A34 P 0
1010101010100000000000 A35 A 1
1010000000000000000000 A36 P 0
1010101010101000000000 A37 A 1
0100000000000000000000 A38 P 0
1010000010101010101010 A39 A 1
0100000000000000000000 A40 P 1
1010101000000000000000 A41 A 1
0100000000000000000000 A42 P 0
1001000000000000000000 A43 P 0
1010101000000000000000 A44 P 0
1010101010101010101010 A45 A 0
1001000000000000000000 A46 P 0
1010100000000000000000 A47 A 1
0100000000000000000000 A48 P 0
1010101010000000000000 A49 J 0
1010101000000000000000 A50 A 0
1010001000000000000000 A51 A 1
1001000000000000000000 A52 P 0
1010101010101000000000 A53 A 1
1001000000000000000000 A54 P 1
1010101010101000000000 A55 A 1
1001000000000000000000 A56 P 1
1010101010101000000000 A57 A 1
1010101000000000000000 A58 P 0
1010101010000000000000 A59 A 1
0100000000000000000000 A60 P 1
1010100000000000000000 A61 A 1
1010100000000000000000 A62 P 1
1010100000101000100000 A63 A 1
0100000000000000000000 A64 P 1
1010101010100000000000 A65 A 1
1001000000000000000000 A66 P 0
1010101010101010101000 A67 A 1
1010100000101000000000 A68 P 0
1010100010101000000000 A69 A 1
1001000000000000000000 A70 P 1
1010100000000000000000 A71 A 1
0100000000000000000000 A72 P 1
1010100000000000000000 A73 A 1
0100000000000000000000 A74 P 1
1010101010000000000000 A75 A 1
1010100000000000000000 A76 P 1
1010101010101000000000 A77 A 1
1010100000000000000000 A78 P 1
1010000000001010000000 A79 A 1
0100000000000000000000 A80 P 1
1000100000000000000000 A81 A 1
1001000000000000000000 A82 P 1
1000000000000000000000 A83 A 1
1001000000000000000000 A84 P 1
1010101010100000000000 A85 A 1
1010100010101010101000 A86 P 1
1010100010101000101000 A87 A 1
1001000000000000000000 A88 P 0
1010100000000000000000 A89 P 0
1010100010101010000000 A90 P 1
1010000000000000000000 A91 P 1
1010100000000000000000 A92 J 0
1010100000000000000000 A93 A 1
1010000000000000000000 A94 P 0
1010100000100000000000 A95 A 1
1001000000000000000000 A96 P 1
1010101000001010000000 A97 A 1
1010101010100000000000 A98 P 0
1001000000000000000000 A99 P 0

Thanks for your time!
su2283
 
Posts: 2
Joined: Thu Oct 29, 2009 3:49 pm
Location: University of British Columbia

Postby jlaake » Thu Oct 29, 2009 5:08 pm

Check your dataframe again. I took your data and copied it into a txt fle and it worked fine:

> xx=import.chdata("testb.txt")
> str(xx)
'data.frame': 100 obs. of 4 variables:
$ ch : chr "1010101000000000000010" "1000101000000000000000" "1010101000001010000000" "1010101000001000000000" ...
$ tag : Factor w/ 100 levels "A00","A01","A02",..: 1 2 3 4 5 6 7 8 9 10 ...
$ age.tagged: Factor w/ 3 levels "A","J","P": 2 2 2 1 3 1 3 3 3 3 ...
$ sex : Factor w/ 2 levels "0","1": 2 2 1 2 1 2 2 1 2 2 ...
> xx.p=process.data(xx,"Burnham")
>

However if I change ch to a numeric variable then I get your error. You must have somehow changed ch to numeric. Do an str()

> xx$ch=as.numeric(xx$ch)
> xx.p=process.data(xx,"Burnham")
Error in process.data(xx, "Burnham") :
Capture history length is not constant. ch must be a character string
row numbers with incorrect ch length 1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,49,50,51,52,53,54,55,56,57,58,59,60,61,64,65,66,67,68,69,70,71,73,75,76,78,80,81,83,84,85,86,87,88,89,91,92,95,96,97,98,99,100
>
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA


Return to RMark

Who is online

Users browsing this forum: No registered users and 2 guests