Skip to content

Commit 8c089d3

Browse files
authored
Merge pull request #143 from EmilHvitfeldt/modelspec_predict
PR regarding #139
2 parents 73f001e + f252377 commit 8c089d3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ S3method(predict,"_elnet")
1414
S3method(predict,"_lognet")
1515
S3method(predict,"_multnet")
1616
S3method(predict,model_fit)
17+
S3method(predict,model_spec)
1718
S3method(predict,nullmodel)
1819
S3method(predict_class,"_lognet")
1920
S3method(predict_class,model_fit)

R/predict.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
predict.model_fit <- function (object, new_data, type = NULL, opts = list(), ...) {
9494
if (any(names(enquos(...)) == "newdata"))
9595
stop("Did you mean to use `new_data` instead of `newdata`?", call. = FALSE)
96-
96+
9797
type <- check_pred_type(object, type)
9898
if (type != "raw" && length(opts) > 0)
9999
warning("`opts` is only used with `type = 'raw'` and was ignored.")
@@ -224,4 +224,7 @@ multi_predict.default <- function(object, ...)
224224
stop ("No `multi_predict` method exists for objects with classes ",
225225
paste0("'", class(), "'", collapse = ", "), call. = FALSE)
226226

227-
227+
#' @export
228+
predict.model_spec <- function(object, ...) {
229+
stop("You must use `fit()` on your model specification before you can use `predict()`.", call. = FALSE)
230+
}

0 commit comments

Comments
 (0)