Skip to content

Commit 6820609

Browse files
authored
merge pr #732: prompt on unavailable extension packages
2 parents 64e7125 + 51ffc03 commit 6820609

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+213
-62
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
* `predict(type = "prob")` will now provide an error if the outcome variable has a level called `"class"` (#720).
1414

15+
* Model type functions will now message informatively if a needed parsnip extension package is not loaded (#731).
16+
1517
# parsnip 0.2.1
1618

1719
* Fixed a major bug in spark models induced in the previous version (#671).

R/arguments.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ set_args <- function(object, ...) {
6767
eng_args = object$eng_args,
6868
mode = object$mode,
6969
method = NULL,
70-
engine = object$engine
70+
engine = object$engine,
71+
check_missing_spec = FALSE
7172
)
7273
}
7374

R/bag_mars.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ print.bag_mars <- function(x, ...) {
4747
cat("Bagged MARS Model Specification (", x$mode, ")\n\n", sep = "")
4848
model_printer(x, ...)
4949

50-
if (!is.null(x$method$fit$args)) {
50+
if (is_printable_spec(x)) {
5151
cat("Model fit template:\n")
5252
print(show_call(x))
5353
}

R/bag_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ print.bag_tree <- function(x, ...) {
5151
cat("Bagged Decision Tree Model Specification (", x$mode, ")\n\n", sep = "")
5252
model_printer(x, ...)
5353

54-
if (!is.null(x$method$fit$args)) {
54+
if (is_printable_spec(x)) {
5555
cat("Model fit template:\n")
5656
print(show_call(x))
5757
}

R/bart.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ print.bart <- function(x, ...) {
9595
cat("BART Model Specification (", x$mode, ")\n\n", sep = "")
9696
model_printer(x, ...)
9797

98-
if(!is.null(x$method$fit$args)) {
98+
if (is_printable_spec(x)) {
9999
cat("Model fit template:\n")
100100
print(show_call(x))
101101
}

R/boost_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ print.boost_tree <- function(x, ...) {
8484
cat("Boosted Tree Model Specification (", x$mode, ")\n\n", sep = "")
8585
model_printer(x, ...)
8686

87-
if (!is.null(x$method$fit$args)) {
87+
if (is_printable_spec(x)) {
8888
cat("Model fit template:\n")
8989
print(show_call(x))
9090
}

R/c5_rules.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ print.C5_rules <- function(x, ...) {
6868
cat("C5.0 Model Specification (", x$mode, ")\n\n", sep = "")
6969
model_printer(x, ...)
7070

71-
if (!is.null(x$method$fit$args)) {
71+
if (is_printable_spec(x)) {
7272
cat("Model fit template:\n")
7373
print(show_call(x))
7474
}

R/cubist_rules.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ print.cubist_rules <- function(x, ...) {
9494
cat("Cubist Model Specification (", x$mode, ")\n\n", sep = "")
9595
model_printer(x, ...)
9696

97-
if (!is.null(x$method$fit$args)) {
97+
if (is_printable_spec(x)) {
9898
cat("Model fit template:\n")
9999
print(show_call(x))
100100
}

R/decision_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ print.decision_tree <- function(x, ...) {
5656
cat("Decision Tree Model Specification (", x$mode, ")\n\n", sep = "")
5757
model_printer(x, ...)
5858

59-
if (!is.null(x$method$fit$args)) {
59+
if (is_printable_spec(x)) {
6060
cat("Model fit template:\n")
6161
print(show_call(x))
6262
}

R/discrim_flexible.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ print.discrim_flexible <- function(x, ...) {
5050
cat("Flexible Discriminant Model Specification (", x$mode, ")\n\n", sep = "")
5151
model_printer(x, ...)
5252

53-
if (!is.null(x$method$fit$args)) {
53+
if (is_printable_spec(x)) {
5454
cat("Model fit template:\n")
5555
print(show_call(x))
5656
}

0 commit comments

Comments
 (0)