Skip to content

Commit 952575a

Browse files
committed
similar modifications for numeric predictions
1 parent 26f04da commit 952575a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

R/predict.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ format_num <- function(x) {
185185
if (inherits(x, "tbl_spark"))
186186
return(x)
187187

188-
if (isTRUE(ncol(x) > 1)) {
188+
if (isTRUE(ncol(x) > 1) | is.data.frame(x)) {
189189
x <- as_tibble(x, .name_repair = "minimal")
190190
if (!any(grepl("^\\.pred", names(x)))) {
191191
names(x) <- paste0(".pred_", names(x))

R/predict_class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ predict_class.model_fit <- function(object, new_data, ...) {
4242
} else {
4343
if (!inherits(res, "tbl_spark")) {
4444
# Now case where a parsnip model generated `res`
45-
if (tibble::is_tibble(res) && ncol(res) == 1 && is.factor(res[[1]])) {
45+
if (is.data.frame(res) && ncol(res) == 1 && is.factor(res[[1]])) {
4646
res <- res[[1]]
4747
} else {
4848
res$values <- factor(as.character(res$values), levels = object$lvl)

0 commit comments

Comments
 (0)