Skip to content

Commit

Permalink
Eval prediction data at covariates
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipMostert committed Jan 15, 2024
1 parent 3145dee commit b006439
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions R/bruSDM_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ predict.bruSDM <- function(object, data = NULL, formula = NULL, mesh = NULL,
else data <- inlabru::fm_int(mesh, format = format)
}

if (!any(names(data) %in% object$spatCovs$name)) {

for (spatCov in object$spatCovs$name) {

if (!is.null(object$species$speciesIn) && object$species$speciesEffects$Environmental) covIndex <- paste0(object$species$speciesIn, '_', spatCov)
else covIndex <- spatCov

data[[spatCov]] <- inlabru::eval_spatial(where = data,
data = get('spatialcovariates',
envir = object$spatCov$env),
layer = spatCov)


}

}

if (is.null(formula)) {

Expand Down

0 comments on commit b006439

Please sign in to comment.