From e69f2f503f20602e553ab12fcbd109a9c00434f4 Mon Sep 17 00:00:00 2001 From: markseeto <39866968+markseeto@users.noreply.github.com> Date: Fri, 21 May 2021 17:45:18 +1000 Subject: [PATCH] Add drop = FALSE in regressor_coefficients() Add `drop = FALSE` in definition of `regressor_coefficients()` to handle the case when there is only one additional regressor. --- R/R/utilities.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/R/utilities.R b/R/R/utilities.R index 85cd322..57cf3fe 100644 --- a/R/R/utilities.R +++ b/R/R/utilities.R @@ -38,7 +38,7 @@ regressor_coefficients <- function(m){ regr_mus <- unlist(lapply(m$extra_regressors, function (x) x$mu)) regr_stds <- unlist(lapply(m$extra_regressors, function(x) x$std)) - beta_indices <- which(m$train.component.cols[, regr_names] == 1, arr.ind = TRUE)[, "row"] + beta_indices <- which(m$train.component.cols[, regr_names, drop = FALSE] == 1, arr.ind = TRUE)[, "row"] betas <- m$params$beta[, beta_indices, drop = FALSE] # If regressor is additive, multiply by the scale factor to put coefficients on the original training data scale. y_scale_indicator <- matrix(