Skip to content

Commit cffad08

Browse files
committed
suggest rsample
1 parent 8d0b259 commit cffad08

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

DESCRIPTION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Suggests:
3737
magrittr,
3838
modeldata (>= 1.0.0),
3939
recipes (>= 1.0.10.9000),
40+
rsample (>= 1.2.1.9000),
4041
rmarkdown,
4142
testthat (>= 3.0.0)
4243
VignetteBuilder:
@@ -50,6 +51,7 @@ Config/Needs/website:
5051
Remotes:
5152
tidymodels/hardhat,
5253
tidymodels/recipes,
54+
tidymodels/rsample#483,
5355
tidymodels/parsnip,
5456
tidymodels/tailor
5557
Config/testthat/edition: 3

R/post-action-tailor.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ add_tailor <- function(x, tailor, ...) {
4242
check_dots_empty()
4343
validate_tailor_available()
4444
action <- new_action_tailor(tailor)
45-
add_action(x, action, "tailor")
45+
res <- add_action(x, action, "tailor")
46+
if (should_inner_split(res)) {
47+
validate_rsample_available()
48+
}
49+
res
4650
}
4751

4852
#' @rdname add_tailor

R/utils.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ validate_tailor_available <- function(..., call = caller_env()) {
3838
invisible()
3939
}
4040

41+
validate_rsample_available <- function(..., call = caller_env()) {
42+
check_dots_empty()
43+
44+
if (!requireNamespace("rsample", quietly = TRUE)) {
45+
abort(
46+
"The `rsample` package must be available to add a tailor that requires training.",
47+
call = call
48+
)
49+
}
50+
51+
invisible()
52+
}
53+
4154
# ------------------------------------------------------------------------------
4255

4356
# https://github.com/r-lib/tidyselect/blob/10e00cea2fff3585fc827b6a7eb5e172acadbb2f/R/utils.R#L109

0 commit comments

Comments
 (0)