Skip to content

Commit 07e77a9

Browse files
authored
Merge branch 'master' into unexport-predict-funcs
2 parents d8c7484 + 5f746aa commit 07e77a9

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ S3method(predict_raw,"_lognet")
2626
S3method(predict_raw,"_multnet")
2727
S3method(print,boost_tree)
2828
S3method(print,decision_tree)
29+
S3method(print,fit_control)
2930
S3method(print,linear_reg)
3031
S3method(print,logistic_reg)
3132
S3method(print,mars)

R/fit_control.R

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#' Control the fit function
2-
#'
3-
#' Options can be passed to the [fit()] function that control the output and
2+
#'
3+
#' Options can be passed to the [fit()] function that control the output and
44
#' computations
5-
#'
5+
#'
66
#' @param verbosity An integer where a value of zero indicates
77
#' that no messages or output should be shown when packages are
88
#' loaded or when the model is fit. A value of 1 means that package
@@ -14,12 +14,24 @@
1414
#' the model inside of `try(, silent = TRUE)`. If the model fails,
1515
#' an object is still returned (without an error) that inherits the
1616
#' class "try-error".
17-
#' @return A named list with the results of the function call
17+
#' @return An S3 object with class "fit_control" that is a named list with the
18+
#' results of the function call
1819
#' @export
19-
#'
20+
#'
2021

2122
fit_control <- function(verbosity = 1L, catch = FALSE) {
2223
res <- list(verbosity = verbosity, catch = catch)
2324
res <- check_control(res)
25+
class(res) <- "fit_control"
2426
res
2527
}
28+
29+
#' @export
30+
print.fit_control <- function(x, ...) {
31+
cat("parsnip control object\n")
32+
if (x$verbosity > 1)
33+
cat(" - verbose level", x$verbosity, "\n")
34+
if (x$catch)
35+
cat(" - fit errors will be caught\n")
36+
invisible(x)
37+
}

man/fit_control.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)