Skip to content

Commit

Permalink
Merge pull request #366 from sjevelazco/min_gub
Browse files Browse the repository at this point in the history
new message in esm_ family function
  • Loading branch information
sjevelazco authored Feb 5, 2024
2 parents 5d5e98d + b1a76f1 commit 552311c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/esm_gam.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ esm_gam <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))

# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

# Formula
formula1 <- utils::combn(variables, 2)
nms <- apply(utils::combn(variables, 2), 2, function(x) paste(x, collapse = "_")) %>%
Expand Down
5 changes: 5 additions & 0 deletions R/esm_gau.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ esm_gau <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))

# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

# Formula
formula1 <- utils::combn(variables, 2)
nms <- apply(utils::combn(variables, 2), 2, function(x) paste(x, collapse = "_")) %>%
Expand Down
6 changes: 6 additions & 0 deletions R/esm_gbm.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ esm_gbm <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))


# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

if (is.null(n_minobsinnode)) {
n_minobsinnode <- as.integer(nrow(data) * 0.5 / 4)
}
Expand Down
5 changes: 5 additions & 0 deletions R/esm_glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ esm_glm <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))

# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

# Formula
formula1 <- utils::combn(variables, 2)
nms <- apply(utils::combn(variables, 2), 2, function(x) paste(x, collapse = "_")) %>%
Expand Down
5 changes: 5 additions & 0 deletions R/esm_max.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ esm_max <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))

# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

# Formula
formula1 <- utils::combn(variables, 2)
nms <- apply(utils::combn(variables, 2), 2, function(x) paste(x, collapse = "_")) %>%
Expand Down
5 changes: 5 additions & 0 deletions R/esm_net.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ esm_net <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))

# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

# Formula
formula1 <- utils::combn(variables, 2)
nms <- apply(utils::combn(variables, 2), 2, function(x) paste(x, collapse = "_")) %>%
Expand Down
5 changes: 5 additions & 0 deletions R/esm_svm.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ esm_svm <- function(data,
. <- part <- model <- TPR <- IMAE <- rnames <- thr_value <- n_presences <- n_absences <- AUC_mean <- pr_ab <- NULL
variables <- dplyr::bind_rows(c(c = predictors))

# N of predictor requirement
if (length(predictors) <= 2) {
stop("The 'esm_' family function should be used to build models with more than 2 predictors, use the 'fit_' or 'tune_' family functions instead")
}

# Formula
formula1 <- utils::combn(variables, 2)
nms <- apply(utils::combn(variables, 2), 2, function(x) paste(x, collapse = "_")) %>%
Expand Down

0 comments on commit 552311c

Please sign in to comment.