Skip to content

address knitr installation dependency #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# parsnip (development version)

* Fixed installation failures due to undocumented knitr installation dependency (#785).

# parsnip 1.0.1

* 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).
Expand Down
10 changes: 10 additions & 0 deletions R/aaa.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,13 @@ function(results, object) {
}
res
}

combine_words <- function(x) {
if (isTRUE(length(x) > 2)) {
last <- ", and "
} else {
last <- " and "
}

glue::glue_collapse(x, ", ", last = last)
}
2 changes: 1 addition & 1 deletion R/engine_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ make_engine_list <- function(mod) {
dplyr::pull(mode) %>%
unique() %>%
sort() %>%
knitr::combine_words()
combine_words()
notes <- paste0(
notes, " ",
cli::symbol$sup_2, " Requires a parsnip extension package for ",
Expand Down
2 changes: 1 addition & 1 deletion man/rmd/aaa.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ descr_models <- function(mod, eng) {
} else {
txt <- "are multiple modes:"
}
paste("For this engine, there", txt, knitr::combine_words(res))
paste("For this engine, there", txt, combine_words(res))
}

uses_extension <- function(mod, eng, mod_mode) {
Expand Down
28 changes: 28 additions & 0 deletions tests/testthat/_snaps/misc.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# combine_words helper works

Code
combine_words(1)
Output
1

---

Code
combine_words(1:2)
Output
1 and 2

---

Code
combine_words(1:3)
Output
1, 2, and 3

---

Code
combine_words(1:4)
Output
1, 2, 3, and 4

# model type functions message informatively with unknown implementation

Code
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ test_that('S3 method dispatch/registration', {

})

# ------------------------------------------------------------------------------
test_that("combine_words helper works", {
expect_snapshot(combine_words(1))
expect_snapshot(combine_words(1:2))
expect_snapshot(combine_words(1:3))
expect_snapshot(combine_words(1:4))
})

# ------------------------------------------------------------------------------

test_that('control class', {
Expand Down