Skip to content

Commit

Permalink
Fix fake mesh if spatial only #59
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Mar 23, 2022
1 parent b10b3fd commit 1167f6f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions R/fit.R
Expand Up @@ -442,11 +442,10 @@ sdmTMB <- function(
if (!include_spatial && spatiotemporal == "off" || !include_spatial && spatial_only) {
# message("Both spatial and spatiotemporal fields are set to 'off'.")
control$map_rf <- TRUE
}
if ((spatial == "off" || isFALSE(spatial)) && spatiotemporal == "off" && missing(mesh)) {
# message("Constructing fake mesh object.")
data$sdmTMB_X_ <- data$sdmTMB_Y_ <- stats::runif(nrow(data))
mesh <- make_mesh(data, c("sdmTMB_X_", "sdmTMB_Y_"), cutoff = 1)
if (missing(mesh)) {
data$sdmTMB_X_ <- data$sdmTMB_Y_ <- stats::runif(nrow(data))
mesh <- make_mesh(data, c("sdmTMB_X_", "sdmTMB_Y_"), cutoff = 1)
}
}
if (is_present(spde)) {
deprecate_warn("0.0.20", "sdmTMB(spde)", "sdmTMB(mesh)")
Expand Down

0 comments on commit 1167f6f

Please sign in to comment.