Skip to content

Commit 6499cd4

Browse files
committed
fix for #187
1 parent 1210275 commit 6499cd4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

R/mars.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
#' @examples
6060
#' mars(mode = "regression", num_terms = 5)
6161
#' @export
62-
6362
mars <-
6463
function(mode = "unknown",
6564
num_terms = NULL, prod_degree = NULL, prune_method = NULL) {
@@ -149,7 +148,7 @@ translate.mars <- function(x, engine = x$engine, ...) {
149148
# see if it is there and, if not, add the default value.
150149
if (x$mode == "classification") {
151150
if (!("glm" %in% names(x$eng_args))) {
152-
x$eng_args$glm <- quote(list(family = stats::binomial))
151+
x$eng_args$glm <- rlang::quo(list(family = stats::binomial))
153152
}
154153
}
155154

@@ -193,8 +192,8 @@ earth_reg_updater <- function(num, object, new_data, ...) {
193192
if (ncol(pred) == 1) {
194193
res <- tibble::tibble(.pred = pred[, 1], nprune = num)
195194
} else {
196-
res <- tibble::as_tibble(res)
197195
names(res) <- paste0(".pred_", names(res))
196+
res <- tibble::as_tibble(res)
198197
res$nprune <- num
199198
}
200199
res

tests/testthat/test_mars.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ test_that('primary arguments', {
2929
y = expr(missing_arg()),
3030
weights = expr(missing_arg()),
3131
nprune = new_empty_quosure(4),
32-
glm = expr(list(family = stats::binomial)),
32+
glm = rlang::quo(list(family = stats::binomial)),
3333
keepxy = TRUE
3434
)
3535
)
@@ -244,6 +244,7 @@ test_that('submodel prediction', {
244244
cls_fit <- class_fit$fit
245245
cls_fit$call[["pmethod"]] <- eval_tidy(cls_fit$call[["pmethod"]])
246246
cls_fit$call[["keepxy"]] <- eval_tidy(cls_fit$call[["keepxy"]])
247+
cls_fit$call[["glm"]] <- eval_tidy(cls_fit$call[["glm"]])
247248

248249
pruned_cls <- update(cls_fit, nprune = 5)
249250
pruned_cls_pred <- predict(pruned_cls, wa_churn[1:4, vars], type = "response")[,1]

0 commit comments

Comments
 (0)