Skip to content
Prev 4046 / 7420 Next

Using the mra package in R...

Hi Sarah and all

Thanks for those couple of tips. They did help to show that the data
imported alright but that there was a distinct difference between my data
set and the example data set for used to demonstrate the mra package.

I have attached subset of my data as suggested. Its formatted as a
tab-delimited text file with row names included (bird band numbers). I have
tried importing with and without row names but this doesn't appear to make
any difference.

To import to R, I have been using the following process.

brtb <- read.table (file="filepath\\brtb.txt", header = TRUE, row.names =
1, sep = "", colClasses="numeric")

Inspecting the data using str(brtb) provides the following

'data.frame':	65 obs. of  19 variables:
 $ C1 : num  0 0 0 0 0 0 0 0 1 1 ...
 $ C2 : num  1 1 0 0 0 0 0 0 0 0 ...
 $ C3 : num  1 0 1 1 1 1 1 1 0 0 ...
 $ C4 : num  0 0 0 0 0 0 0 0 0 0 ...
 $ C5 : num  0 0 0 0 1 0 0 0 0 0 ...
 $ C6 : num  0 0 0 0 0 0 0 0 0 0 ...
 $ C7 : num  0 0 0 0 0 0 0 0 0 0 ...
 $ C8 : num  0 0 0 0 0 0 0 0 0 0 ...
 $ C9 : num  0 0 0 0 0 0 0 0 0 0 ...
 $ C10: num  0 0 0 0 0 0 0 0 1 0 ...
 $ C11: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C12: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C13: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C14: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C15: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C16: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C17: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C18: num  0 0 0 0 0 0 0 0 0 0 ...
 $ C19: num  0 0 0 0 0 0 0 0 0 0 ...

The comparative example I am looking at from the mra package is the
dipper.histories data. Inspecting this with str(dipper.histories) provides
the following

 num [1:294, 1:7] 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:294] "1" "2" "3" "4" ...
  ..$ : chr [1:7] "h1" "h2" "h3" "h4" ...

There is an obvious difference in the returned output from the str()
function. Inspection of both data frames shows they are formatted in a
similar way, or at least appear to be.

With respect to the function I am attempting to run in mra, I have run the
examples routines as described in the mra manual using the supplied data.
Results as described. In attempting this on any of my own data as attached
I get an error message. The function I am trying to run is as follows

brtb.cjs = F.cjs.estim(
~x2+x3+x4+x5+x6+x7+x8+x9+x10+x11+x12+x13+x14+x15+x16+x17+x18,
~x1+x2+x3+x4+x5+x6+x7+x8+x9+x10+x11+x12+x13+x14+x15+x16+x17, brtb)


Each time I get the following error

Error in F.cjs.estim(~x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 +  :
  Capture histories must consist of 0's, 1's, and 2's only.

I have checked thru the data-set to make sure the data matches these
requirements, that there are no additional characters in the data-set, etc.
and keep getting the same error. Have tried a different subsets of the
data, different import options, etc. but still no success.

Am assuming the error lies with the format of the data imported to R but
cannot work out where or how to adjust to match the example.

Any suggestions or advice on this one would be greatly appreciated.

Cheers

Adam...
On 25 August 2013 23:33, Sarah Goslee <sarah.goslee at gmail.com> wrote: