Skip to content

Commit

Permalink
Conditionally check attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Nov 1, 2023
1 parent b10ce3d commit 858e60f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,12 @@ predict.sdmTMB <- function(object, newdata = NULL,
sims <- nsim
}

# TODO check if missing and only use attribute then!!
assert_that(model[[1]] %in% c(NA, 1, 2),
msg = "`model` argument not valid; should be one of NA, 1, 2")
if (missing(model)) {
if (.has_delta_attr(object)) model <- attr(object, "delta_model_predict") # for ggpredict
}
model <- model[[1]]
if (.has_delta_attr(object)) model <- attr(object, "delta_model_predict") # for ggpredict
type <- match.arg(type)
# FIXME parallel setup here?

Expand Down

0 comments on commit 858e60f

Please sign in to comment.