Error in read.capthist

questions concerning anlysis/theory using program DENSITY and R package secr. Focus on spatially-explicit analysis.

Error in read.capthist

Postby adamdillon » Thu Mar 05, 2015 2:53 pm

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
adamdillon
 
Posts: 21
Joined: Tue Mar 03, 2015 2:11 pm

Re: Error in read.capthist

Postby murray.efford » Thu Mar 05, 2015 2:55 pm

You could try spelling 'noccasions' correctly... :)
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Error in read.capthist

Postby adamdillon » Thu Mar 05, 2015 3:04 pm

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?
adamdillon
 
Posts: 21
Joined: Tue Mar 03, 2015 2:11 pm

Re: Error in read.capthist

Postby murray.efford » Thu Mar 05, 2015 3:11 pm

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
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Error in read.capthist

Postby valeria.boron » Mon May 11, 2015 11:51 am

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
valeria.boron
 
Posts: 7
Joined: Mon Aug 13, 2012 6:34 am

Re: Error in read.capthist

Postby murray.efford » Mon May 11, 2015 3:58 pm

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
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Error in read.capthist

Postby valeria.boron » Tue May 19, 2015 5:21 am

Thank you for your help! At the end it worked with a .csv file saved directly from Excel.
valeria.boron
 
Posts: 7
Joined: Mon Aug 13, 2012 6:34 am


Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest

cron