Skip to content

Commit a69b49c

Browse files
EmilHvitfeldt‘topepo’
andauthored
Rc 1.1.0 (#1342)
* polish news * community.rstudio -> forum.posit * devtools::build_readme() * remove Remotes * update news * make recipes_ptype() return NULL for old recipes * run revdepcheck * add skip_on_cran * version bump * "Please provide package anchors for all Rd \link{} targets not in the package itself and the base packages." --------- Co-authored-by: ‘topepo’ <‘[email protected]’>
1 parent a0497a6 commit a69b49c

File tree

19 files changed

+288
-134
lines changed

19 files changed

+288
-134
lines changed

DESCRIPTION

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: recipes
22
Title: Preprocessing and Feature Engineering Steps for Modeling
3-
Version: 1.0.10.9000
3+
Version: 1.1.0
44
Authors@R: c(
55
person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre")),
66
person("Hadley", "Wickham", , "[email protected]", role = "aut"),
@@ -26,7 +26,7 @@ Imports:
2626
generics (>= 0.1.2),
2727
glue,
2828
gower,
29-
hardhat (>= 1.3.1.9000),
29+
hardhat (>= 1.4.0),
3030
ipred (>= 0.9-12),
3131
lifecycle (>= 1.0.3),
3232
lubridate (>= 1.8.0),
@@ -71,5 +71,3 @@ Config/testthat/edition: 3
7171
Encoding: UTF-8
7272
Roxygen: list(markdown = TRUE)
7373
RoxygenNote: 7.3.1
74-
Remotes:
75-
tidymodels/hardhat

NEWS.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,54 @@
1-
# recipes (development version)
1+
# recipes 1.1.0
22

3-
* New `extract_fit_time()` method has been added that returns the time it took to train the recipe. (#1071)
3+
## Improvements
44

5-
* `step_spline_b()`, `step_spline_convex()`, `step_spline_monotone()`, and `step_spline_nonnegative()` now throws informative errors if the`degree`, `deg_free`, and `complete_set` arguments causes an error. (#1170)
5+
* Improved error message for misspelled argument in step functions. (#1318)
66

7-
* Developer helper function `recipes_ptype()` has been added, returning expected input data for `prep()` and `bake()` for a given recipe object. (#1329)
7+
* `recipe()` can now take data.frames with list-columns or sf data.frames as input to `data`. (#1283)
88

9-
* Developer helper function `recipes_ptype_validate()` has been added, to validate new data is compatible with recipe ptype. (#793)
9+
* `recipe()` will now show better error when columns are misspelled in formula (#1283).
1010

11-
* The `prefix` argument of `step_dummy_multi_choice()` is not properly documented. (#1298)
11+
* `add_role()` now errors if a column would simultaneously have roles `"outcome"` and `"predictor"`. (#935)
1212

13-
* `step_dummy()` now gives an informative error on attempt to generate too many columns to fit in memory. (#828)
13+
* `prep()` will now error if the ptype of the data doesn't match which was used to define the recipe. (#793)
1414

15-
* `NA` levels in factors aren't dropped when passed to `recipe()`. (#1291)
15+
* Added more documentation in `?selections` about how `tidyselect::everything()` works in recipes. (#1259)
1616

17-
* `recipe()` no longer crashes when given long formula expression (#1283).
17+
* New `extract_fit_time()` method has been added that returns the time it took to train the recipe. (#1071)
1818

19-
* `step_interact()` now gives better error if `terms` isn't a formula. (#1299)
19+
* `step_spline_b()`, `step_spline_convex()`, `step_spline_monotone()`, and `step_spline_nonnegative()` now throws informative errors if the`degree`, `deg_free`, and `complete_set` arguments causes an error. (#1170)
2020

21-
* `recipe()` will now show better error when columns are misspelled in formula (#1283).
21+
* `step_mutate()` gained `.pkgs` argument to specify what packages need to be loaded for step to work. (#1282)
2222

23-
* Fixed bug in `step_ns()` and `step_bs()` where `knots` field in `options` argument wasn't correctly used. (#1297)
23+
* `step_interact()` now gives better error if `terms` isn't a formula. (#1299)
2424

25-
* `add_role()` now errors if a column would simultaneously have roles `"outcome"` and `"predictor"`. (#935)
25+
* The `prefix` argument of `step_dummy_multi_choice()` is now properly documented. (#1298)
2626

2727
* Significant speedup in `step_dummy()` when applied to many columns. (#1305)
2828

29-
* Bug fixed in `step_interact()` where long formulas were used. (#1231, #1289)
30-
31-
* `recipe()` can now take data.frames with list-columns or sf data.frames as input to `data`. (#1283)
29+
* `step_dummy()` now gives an informative error on attempt to generate too many columns to fit in memory. (#828)
3230

3331
* `step_dummy()` and `step_unknown()` now throw more informative warnings for unseen levels. (#450)
3432

3533
* `step_dummy()` now throws more informative warnings for `NA` values. (#450)
3634

35+
## Bug Fixes
36+
37+
* `NA` levels in factors aren't dropped when passed to `recipe()`. (#1291)
38+
39+
* `recipe()` no longer crashes when given long formula expression (#1283).
40+
41+
* Fixed bug in `step_ns()` and `step_bs()` where `knots` field in `options` argument wasn't correctly used. (#1297)
42+
43+
* Bug fixed in `step_interact()` where long formulas were used. (#1231, #1289)
44+
3745
* Fixed documentation mistake where default value of `keep_original_cols` argument were wrong. (#1314)
3846

39-
* `step_mutate()` gained `.pkgs` argument to specify what packages need to be loaded for step to work. (#1282)
47+
## Developer
4048

41-
* Added more documentation in `?selections` about how `tidyselect::everything()` works in recipes. (#1259)
49+
* Developer helper function `recipes_ptype()` has been added, returning expected input data for `prep()` and `bake()` for a given recipe object. (#1329)
4250

43-
* Improved error message for misspelled argument in step functions. (#1318)
51+
* Developer helper function `recipes_ptype_validate()` has been added, to validate new data is compatible with recipe ptype. (#793)
4452

4553
* Developer helper functions `recipes_names_predictors()` and `recipes_names_outcomes()` have been added to aid variable selection in steps. (#1026)
4654

R/ptype.R

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#' with `update_role_requirements()`, and `recipes_ptype()` respects those
4141
#' changes.
4242
#'
43+
#' `recipes_ptype()` returns `NULL` on recipes created prior to version 1.1.0.
44+
#'
4345
#' Note that the order of the columns aren't guaranteed to align with
4446
#' `data_ptype` as the data internally is ordered according to roles.
4547
#'
@@ -84,13 +86,9 @@
8486
recipes_ptype <- function(x, ..., stage = "prep") {
8587
check_dots_empty0(...)
8688

89+
# recipe created prior to 1.1.0
8790
if (is.null(x$ptype)) {
88-
cli::cli_abort(
89-
c(
90-
x = "Doesn't work on recipes created prior to version 1.1.0.",
91-
i = "Please recreate recipe."
92-
)
93-
)
91+
return(NULL)
9492
}
9593

9694
ptype <- x$ptype
@@ -112,6 +110,15 @@ recipes_ptype <- function(x, ..., stage = "prep") {
112110
ptype
113111
}
114112

113+
114+
long_function_name <- function(x,
115+
...,
116+
verbose = FALSE) {
117+
x
118+
}
119+
120+
121+
115122
#' Validate prototype of recipe object
116123
#'
117124
#' This helper function validates a dataframe against the ptype of a recipe.
@@ -143,6 +150,12 @@ recipes_ptype_validate <- function(x,
143150
stage = "prep",
144151
call = rlang::caller_env()) {
145152
old_ptype <- recipes_ptype(x, stage = stage)
153+
154+
# recipe created prior to 1.1.0
155+
if (is.null(old_ptype)) {
156+
return(invisible())
157+
}
158+
146159
col_names <- names(old_ptype)
147160

148161
new_ptype <- vctrs::vec_ptype(new_data)

R/recipe.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ bake <- function(object, ...) {
596596
#' @param ... One or more selector functions to choose which variables will be
597597
#' returned by the function. See [selections()] for more details.
598598
#' If no selectors are given, the default is to use
599-
#' [everything()].
599+
#' [dplyr::everything()].
600600
#' @param composition Either "tibble", "matrix", "data.frame", or
601601
#' "dgCMatrix" for the format of the processed data set. Note that
602602
#' all computations during the baking process are done in a

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pak::pak("tidymodels/recipes")
5454

5555
## Contributing
5656

57-
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://community.rstudio.com/c/ml/15).
57+
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://forum.posit.co/c/ml/15).
5858

5959
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/recipes/issues).
6060

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,18 @@ pak::pak("tidymodels/recipes")
5757

5858
## Contributing
5959

60-
- For questions and discussions about tidymodels packages, modeling,
61-
and machine learning, please [post on RStudio
62-
Community](https://community.rstudio.com/c/ml/15).
60+
- For questions and discussions about tidymodels packages, modeling, and
61+
machine learning, please [post on RStudio
62+
Community](https://forum.posit.co/c/ml/15).
6363

64-
- If you think you have encountered a bug, please [submit an
65-
issue](https://github.com/tidymodels/recipes/issues).
64+
- If you think you have encountered a bug, please [submit an
65+
issue](https://github.com/tidymodels/recipes/issues).
6666

67-
- Either way, learn how to create and share a
68-
[reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html)
69-
(a minimal, reproducible example), to clearly communicate about your
70-
code.
67+
- Either way, learn how to create and share a
68+
[reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html)
69+
(a minimal, reproducible example), to clearly communicate about your
70+
code.
7171

72-
- Check out further details on [contributing guidelines for tidymodels
73-
packages](https://www.tidymodels.org/contribute/) and [how to get
74-
help](https://www.tidymodels.org/help/).
72+
- Check out further details on [contributing guidelines for tidymodels
73+
packages](https://www.tidymodels.org/contribute/) and [how to get
74+
help](https://www.tidymodels.org/help/).

man/bake.Rd

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

man/juice.Rd

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

man/recipe.Rd

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

man/recipes_ptype.Rd

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

0 commit comments

Comments
 (0)