Page 1 of 1

Error in read.capthist

PostPosted: Thu Mar 05, 2015 2:53 pm
by adamdillon
I am trying to test a couple of models and I'm having a problem with the read.capthist() command.

When I use read.capthist() with a capture file that has two sessions (Adults and Pups) I have no problem.

Adults.And.Pups.2014 <- read.capthist("Capture_File_Adults_And_Pups_2014.txt", "Detection_File_No_Extra_Traps.txt", detector = "multi", fmt="trapID", noccasions = c(6,6))

But when I separate the Adults and Pups into separate files, and therefore only a single session,

Adults.2014 <- read.capthist("Capture_File_Adults_2014.txt", "Detection_File_No_Extra_Traps.txt",
detector = "multi", fmt="trapID", nooccasions = 6)

I get the following error message.

Error in rep(NA, nfield - nvar) : invalid 'times' argument

Anyone have any suggestions?

Thanks

Re: Error in read.capthist

PostPosted: Thu Mar 05, 2015 2:55 pm
by murray.efford
You could try spelling 'noccasions' correctly... :)

Re: Error in read.capthist

PostPosted: Thu Mar 05, 2015 3:04 pm
by adamdillon
Actually I just spelled it wrong on the post, I've got it correct in my code, but still the same error message.

Adults.2014 <- read.capthist("Capture_File_Adults_2014.txt", "Detection_File_No_Extra_Traps.txt",
detector = "multi", fmt="trapID", noccasions=6)

Any other ideas?

Re: Error in read.capthist

PostPosted: Thu Mar 05, 2015 3:11 pm
by murray.efford
I expect there's a problem in your file. You don't need to input the sessions separately. Use subset (?subset.capthist) or split (?split.capthist) to separate sessions.
Murray

Re: Error in read.capthist

PostPosted: Mon May 11, 2015 11:51 am
by valeria.boron
I get the same error message "Error in rep(NA, nfield - nvar) : invalid 'times' argument". I understand the error is probably in the data files and I reviewed them without being able to find any errors. Any further suggestion? Thank you very much in advance

Re: Error in read.capthist

PostPosted: Mon May 11, 2015 3:58 pm
by murray.efford
If you can't find the problem by viewing the text file it may help to (try to) read it into R as a dataframe with read.table().
Murray

Re: Error in read.capthist

PostPosted: Tue May 19, 2015 5:21 am
by valeria.boron
Thank you for your help! At the end it worked with a .csv file saved directly from Excel.