Skip to content

Commit

Permalink
Correct warning in BIOMOD_presenceonly
Browse files Browse the repository at this point in the history
  • Loading branch information
MayaGueguen committed Aug 31, 2021
1 parent 9d34572 commit c1e587c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions R/BIOMOD_presenceonly.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
##'
##' @examples
##' \dontrun{
##' requireNamesapce(PresenceAbsence, 'PresenceAbsence', quietly = TRUE)
##' requireNamespace(PresenceAbsence, 'PresenceAbsence', quietly = TRUE)
##'
##' # species occurrences
##' DataSpecies <- read.csv(system.file("external/species/mammals_table.csv",
Expand Down Expand Up @@ -213,16 +213,17 @@ BIOMOD_presenceonly <- function(modeling.output = NULL, EM.output = NULL, bg.env
Pred <- myModelPred[calib.lines,Model.name]
# }
}else{
test <- c(myResp[myResp==1],rep(0,nrow(bg.env)))
Pred <- c(myModelPred.pres[,Model.name],myModelPred[,Model.name])
test <- c(myResp[which(myResp == 1)], rep(0, nrow(bg.env)))
Pred <- c(myModelPred.pres[, Model.name], myModelPred[, Model.name])
}
}else{
if(is.null(bg.env)){
test <- myResp[ind.eval] #### CORRECTION
Pred <- myModelPred[ind.eval,Model.name] #### CORRECTION
Pred <- myModelPred[ind.eval, Model.name] #### CORRECTION
}else{
test <- c(myResp[ind.eval & myResp==1],rep(0,nrow(bg.env))) #### CORRECTION
Pred <- c(myModelPred.pres[ind.eval & myResp==1,Model.name],myModelPred[,Model.name]) #### CORRECTION
test <- c(myResp[intersect(ind.eval, which(myResp == 1))], rep(0, nrow(bg.env))) #### CORRECTION
Pred <- c(myModelPred.pres[intersect(ind.eval, which(myResp == 1)), Model.name]
, myModelPred[, Model.name]) #### CORRECTION
}
}
#### CORRECTION ------------------------------------------------------------------------
Expand Down

0 comments on commit c1e587c

Please sign in to comment.