diff --git a/R/engine_bart.R b/R/engine_bart.R index e8b7130a..fb81a162 100644 --- a/R/engine_bart.R +++ b/R/engine_bart.R @@ -319,7 +319,8 @@ engine_bart <- function(x, # All other needed data for model fitting equation <- model$biodiversity[[1]]$equation - data <- cbind(model$biodiversity[[1]]$predictors, data.frame(observed = model$biodiversity[[1]]$observations[,'observed']) ) + data <- cbind(model$biodiversity[[1]]$predictors, + data.frame(observed = model$biodiversity[[1]]$observations[,'observed', drop = TRUE]) ) # Subset to predictor names data <- subset(data, select = c('observed', model$biodiversity[[1]]$predictors_names) ) if(model$biodiversity[[1]]$family=='binomial') data$observed <- factor(data$observed) diff --git a/R/engine_breg.R b/R/engine_breg.R index 833d8cdb..75de1449 100644 --- a/R/engine_breg.R +++ b/R/engine_breg.R @@ -321,7 +321,7 @@ engine_breg <- function(x, if(!is.null(li)) if(getOption('ibis.setupmessages')) myLog('[Estimation]','red',paste0("Package does not support custom link functions. Ignored!")) form <- model$biodiversity[[1]]$equation df <- cbind(model$biodiversity[[1]]$predictors, - data.frame(observed = model$biodiversity[[1]]$observations[,'observed']) + data.frame(observed = model$biodiversity[[1]]$observations[,'observed', drop = TRUE]) ) df <- subset(df, select = c(model$biodiversity[[1]]$predictors_names, "observed")) w <- model$biodiversity[[1]]$expect # The expected exposure diff --git a/R/engine_gdb.R b/R/engine_gdb.R index 360e69d0..d769d541 100644 --- a/R/engine_gdb.R +++ b/R/engine_gdb.R @@ -324,7 +324,8 @@ engine_gdb <- function(x, # All other needed data for model fitting equation <- model$biodiversity[[1]]$equation - data <- cbind(model$biodiversity[[1]]$predictors, data.frame(observed = model$biodiversity[[1]]$observations[,'observed']) ) + data <- cbind(model$biodiversity[[1]]$predictors, + data.frame(observed = model$biodiversity[[1]]$observations[,'observed', drop = TRUE]) ) w <- model$biodiversity[[1]]$expect # Select predictors diff --git a/R/engine_glmnet.R b/R/engine_glmnet.R index f6ca2867..745e16ad 100644 --- a/R/engine_glmnet.R +++ b/R/engine_glmnet.R @@ -321,7 +321,7 @@ engine_glmnet <- function(x, form <- model$biodiversity[[1]]$equation df <- cbind(model$biodiversity[[1]]$predictors, - data.frame(observed = model$biodiversity[[1]]$observations[,'observed']) + data.frame(observed = model$biodiversity[[1]]$observations[,'observed', drop = TRUE]) ) df <- subset(df, select = c(model$biodiversity[[1]]$predictors_names, "observed")) w <- df$w <- model$biodiversity[[1]]$expect # The expected exposure