Skip to content

Commit

Permalink
Add drop = FALSE in regressor_coefficients()
Browse files Browse the repository at this point in the history
Add `drop = FALSE` in definition of `regressor_coefficients()` to handle the case when there is only one additional regressor.
  • Loading branch information
markseeto committed May 21, 2021
1 parent b75844e commit e69f2f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/R/utilities.R
Expand Up @@ -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(
Expand Down

0 comments on commit e69f2f5

Please sign in to comment.