I think I solved your problem, although read the FAQ of how to post reproducible questions.
The problem you have is basically that nothing in your data, z
, is fulfilling ">= 0.7
" , therefore you are returned with integer(0)
. That is basically what the error message: "In min(which(tg >= 0.7)) : no non-missing arguments to min; returning Inf"
refers to.
The first error message is due to you trying to calculate: "seq_len(integer(0))
" which returns: "Error in seq_len(min(which(tg >= 0.7))) : argument must be coercible to non-negative integer
".
Reproducible data:
tg<-matrix(data=seq(0.01,0.25,0.01),5,5)
seq_len(min(which(tg>=0.7)))
So the solution is: check your matrix "z" and the results from it by dividing the expression seq_len(min(which(tg>=0.7)))
in different parts. First run which(tg>=0.7)
, then min(which(tg>=0.7))
and so on. This is useful for troubleshooting codes in general.
Good luck!