Skip to content

Commit 7ed006d

Browse files
authored
address knitr installation dependency (#790)
1 parent 113f6f5 commit 7ed006d

File tree

6 files changed

+50
-2
lines changed

6 files changed

+50
-2
lines changed

Diff for: NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# parsnip (development version)
22

3+
* Fixed installation failures due to undocumented knitr installation dependency (#785).
4+
35
# parsnip 1.0.1
46

57
* Enabled passing additional engine arguments with the xgboost `boost_tree()` engine. To supply engine-specific arguments that are documented in `xgboost::xgb.train()` as arguments to be passed via `params`, supply the list elements directly as named arguments to `set_engine()`. Read more in `?details_boost_tree_xgboost` (#787).

Diff for: R/aaa.R

+10
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,13 @@ function(results, object) {
8080
}
8181
res
8282
}
83+
84+
combine_words <- function(x) {
85+
if (isTRUE(length(x) > 2)) {
86+
last <- ", and "
87+
} else {
88+
last <- " and "
89+
}
90+
91+
glue::glue_collapse(x, ", ", last = last)
92+
}

Diff for: R/engine_docs.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ make_engine_list <- function(mod) {
224224
dplyr::pull(mode) %>%
225225
unique() %>%
226226
sort() %>%
227-
knitr::combine_words()
227+
combine_words()
228228
notes <- paste0(
229229
notes, " ",
230230
cli::symbol$sup_2, " Requires a parsnip extension package for ",

Diff for: man/rmd/aaa.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ descr_models <- function(mod, eng) {
119119
} else {
120120
txt <- "are multiple modes:"
121121
}
122-
paste("For this engine, there", txt, knitr::combine_words(res))
122+
paste("For this engine, there", txt, combine_words(res))
123123
}
124124
125125
uses_extension <- function(mod, eng, mod_mode) {

Diff for: tests/testthat/_snaps/misc.md

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
# combine_words helper works
2+
3+
Code
4+
combine_words(1)
5+
Output
6+
1
7+
8+
---
9+
10+
Code
11+
combine_words(1:2)
12+
Output
13+
1 and 2
14+
15+
---
16+
17+
Code
18+
combine_words(1:3)
19+
Output
20+
1, 2, and 3
21+
22+
---
23+
24+
Code
25+
combine_words(1:4)
26+
Output
27+
1, 2, 3, and 4
28+
129
# model type functions message informatively with unknown implementation
230

331
Code

Diff for: tests/testthat/test_misc.R

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ test_that('S3 method dispatch/registration', {
6262

6363
})
6464

65+
# ------------------------------------------------------------------------------
66+
test_that("combine_words helper works", {
67+
expect_snapshot(combine_words(1))
68+
expect_snapshot(combine_words(1:2))
69+
expect_snapshot(combine_words(1:3))
70+
expect_snapshot(combine_words(1:4))
71+
})
72+
6573
# ------------------------------------------------------------------------------
6674

6775
test_that('control class', {

0 commit comments

Comments
 (0)