In max(Xid) : no non-missing arguments to max; returning -Inf.

Hi all,

I'm trying to run a simple spatial capture-recapture model using the oSCR package in R, but have come across a simple (and based on an extensive Google) fairly common issue to many different types of scripts. That is, the below error:

Warning message:*
In max(Xid) : no non-missing arguments to max; returning -Inf.

What confuses me is that I have run the identical script for a different data set (whilst making the code dataset-specific, of course), which was far larger in size, and that ran perfectly. However, the error appears for my smaller data set. I would really appreciate any thoughts and ways to fix this error, please. Many thanks in advance!

hog_edf <- read.csv(FILENAME)
hog.tdf <- read.csv(FILENAME) <- 
  data2oscr(edf = hog_edf,
            tdf = list(hog.tdf,hog.tdf,hog.tdf), 
            sess.col = which(colnames(hog_edf)%in%"SESSION"), 
            id.col = which(colnames(hog_edf)%in%"ANIMAL_ID"),
            occ.col = which(colnames(hog_edf)%in%"SO"), 
            trap.col = which(colnames(hog_edf)%in%"TRAP_ID"),
            sex.col = which(colnames(hog_edf)%in%"SEX"),
            sex.nacode = "NA",
            K = c(10,10,10),   #10 occasions per session (3 sessions)
            ntraps = rep(126,3),  #number of capture traps per session (3 sessions)
            trapcov.names = c("hab"),
            tdf.sep = "/")

Reproducible example data:
Hog_edf file:

1 E_BLACK_F Frn_0 1 0
1 A_BLACK_F Frn_1 2 0
1 A_BLACK_M Frn_2 3 1
1 F_BLACK_F Frn_3 4 0
1 D_BLACK_F Frn_4 5 0
1 E_BLACK_M Frn_5 6 1
1 G_BLACK_F Frn_6 7 0
1 A_RED_M Frn_7 8 1
1 D_RED_F Frn_8 8 0
1 E_RED_M Frn_9 9 1
1 F_RED_M Frn_10 10 1

Hog_tdf file:

TRAP_ID X Y sep hab
Frn_0 465078 356398 / urban
Frn_1 465058 356352 / urban
Frn_2 465038 356306 / urban
Frn_3 465008 356270 / urban
Frn_4 464969 356245 / urban
Frn_5 464924 356257 / urban
Frn_6 464924 356303 / urban
Frn_7 464922 356349 / urban
Frn_8 464957 356384 / urban
Frn_9 464992 356416 / urban
Frn_10 464967 356434 / urban

Since your issue is clearly data dependant. Providing sample data would seem a good idea.
There is a useful guide as to how to go about that here

Hi nirgrahamuk! Thank you so much for the response - I have included some sample data in the original post now and would really appreciate any thoughts on this. I'm completely perplexed!
Thanks again!

Have you tested your reprex ? ( i.e. that it reproduces your issue ?)
I can't make it reproduce your error....
You didn't provide the example data in the recommended ways (via datapasta() or dput()) so its possible that impacted what I received to look into. Aside from that, I think the example tdf does not match the params, as I get a complaint about lengths not matching.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.