Hello, I'm currently trying to run an analyses of niche breadth using the ENMTools package and I am getting an error when running the function env.breadth.
Error in if (max(pred) == 0) { : missing value where TRUE/FALSE needed
I figured out the error is related to my enmtools.maxent file, but I can't figure out how to debug this.
Does anyone here know how to fix it?
my code is
files <- stack(list.files(path = "south_america", pattern='.asc', full.names=TRUE))
names(files) <- c("Bio1", "Bio2", "Bio3", "Bio4", "Bio5", "Bio6", "Bio7",
"Bio8", "Bio9", "Bio10", "Bio11", "Bio12", "Bio13", "Bio14", "Bio15",
"Bio16", "Bio17", "Bio18", "Bio19", "Alt", "Srad", "Vapr", "Wind", "Aridity")
sp <- enmtools.species()
sp$
species.name <- "xol"
sp$presence.points <- read.csv2("path.csv", sep=";", dec = ",")
#sp$range <- background.raster.buffer(sp$presence.points, 100000, files)
sp$background.points <- background.points.buffer(points = sp$presence.points,
radius = 20000, n = 1000, mask = files[[1]])
sp$range <- NULL
#sp$background.points <- NULL
sp <- check.species(sp)
#interactive.plot.enmtools.species(sp)
sp.maxent <- enmtools.maxent(sp, files, test.prop = "block", bg.source = "points", verbose= TRUE, env.nback = 1000,
args =c("betamultiplier=4","autofeature=FALSE", "linear", "quadratic", "noproduct",
"hinge", "randomseed=TRUE","jackknife=TRUE", "doclamp=FALSE",
"extrapolate=FALSE", "applythresholdrule=Maximum training sensitivity plus specificity"))
#####
Warning messages:
1: In matrix(as.numeric(d)) : NAs introduced by coercion
2: In cor(x, y) : the standard deviation is zero
3: In cor(x, y) : the standard deviation is zero
4: In cor(x, y) : the standard deviation is zero
5: In cor(x, y) : the standard deviation is zero
nichebreadth <- env.breadth (sp.maxent, files)
######
Error in if (max(pred) == 0) { : missing value where TRUE/FALSE needed
thank you in advance,
Lays