Skip to content

Commit

Permalink
for # 27
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Dec 12, 2024
1 parent dbbfbae commit 6f2c17b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/maxent.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ setMethod("MaxEnt", signature(x="missing", p="missing"),
stop("data should be a matrix, data.frame, or SpatVector")
}
if (dim(x)[2] != 2) {
stop("presence or absence coordinates data should be a matrix or data.frame with 2 columns" )
stop("presence or background coordinates data should be a matrix or data.frame with 2 columns" )
}
colnames(x) <- c("x", "y")
return(x)
Expand Down Expand Up @@ -131,13 +131,13 @@ setMethod("MaxEnt", signature(x="SpatRaster", p="ANY"),
nas <- length(as.vector(attr(av, "na.action")))
if (nas > 0) {
if (nas >= 0.5 * avr) {
stop("more than half of the absence points have NA predictor values")
stop("more than half of the background points have NA predictor values")
} else {
warning(nas, " (", round(100*nas/avr, 2), "%) of the presence points have NA predictor values")
}
}
} else {
# random absence
# random background
if (is.null(nbg)) {
nbg <- 10000
} else {
Expand Down Expand Up @@ -243,7 +243,7 @@ setMethod("MaxEnt", signature(x="data.frame", p="numeric"),
av <- cbind(data.frame(species="background"), x=1:nrow(av), y=1:nrow(av), av)

pfn <- paste(dirout, "/presence", sep="")
afn <- paste(dirout, "/absence", sep="")
afn <- paste(dirout, "/background", sep="")
utils::write.table(pv, file=pfn, sep=",", row.names=FALSE)
utils::write.table(av, file=afn, sep=",", row.names=FALSE)

Expand Down

0 comments on commit 6f2c17b

Please sign in to comment.