Skip to content

Commit f134311

Browse files
author
Diego Barneche
committed
streamlined check_ functions for negative x--no error, drop models instead now
1 parent 2b13ef5 commit f134311

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

R/check_data.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ check_data <- function(data, family, model) {
2828
". The function bnec requires the predictor",
2929
" column to be numeric."))
3030
}
31-
if (contains_negative(x) && model == "necsigm") {
32-
stop("necsigm should only be called when predictor values are >= 0")
33-
}
3431
test_x <- mean(x)
3532
test_y <- mean(y)
3633
if (!is.finite(test_x)) {

R/check_models.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ check_models <- function(model, family, data) {
8585
if (!missing(data)) {
8686
x <- retrieve_var(data, "x_var")
8787
if (contains_negative(x)) {
88-
use_models <- setdiff(model, c("ecxsigm", "nechorme4pwr", "nechormepwr"))
88+
not_allowed <- c("ecxsigm", "nechorme4pwr", "nechormepwr", "necsigm")
89+
use_models <- setdiff(model, not_allowed)
8990
drop_models <- setdiff(model, use_models)
9091
model <- use_models
9192
if (length(drop_models) > 0) {
9293
message(
93-
paste("Dropping the model(s)", drop_models,
94+
paste("Dropping the model(s)", paste0(drop_models, collapse = ", "),
9495
"as they are not valid for data with negative predictor (x)",
9596
"values.")
9697
)

0 commit comments

Comments
 (0)