Skip to content

Commit

Permalink
Fix for legacy recipes in bake.step_log() method
Browse files Browse the repository at this point in the history
- legacy recipes index the `columns` entry of `object`
  whereas newer recipes index `names(object$columns)`
- this breaks backward compatibility
- This bugfix prefers the 'new' syntax, but if
  `names(object)` is `NULL`, reverts to the 'old' syntax
- fixes tidymodels#1284
  • Loading branch information
stufield committed Feb 12, 2024
1 parent 36a1307 commit 3e3408c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Expand Up @@ -24,6 +24,8 @@

## Bug Fixes

* Fixed bug where `step_log()` breaks legacy recipe objects by indexing `names(object)` in `bake()`. (@stufield, #1284)

* Fixed bug where `step_factor2string()` if `strings_as_factors = TRUE` is set in `prep()`. (#317)

* Fixed bug where `tidy.step_cut()` always returned zero row tibbles for trained recipes. (#1229)
Expand Down
2 changes: 1 addition & 1 deletion R/log.R
Expand Up @@ -124,7 +124,7 @@ prep.step_log <- function(x, training, info = NULL, ...) {

#' @export
bake.step_log <- function(object, new_data, ...) {
col_names <- names(object$columns)
col_names <- names(object$columns) %||% object$columns
check_new_data(col_names, object, new_data)

# for backward compat
Expand Down

0 comments on commit 3e3408c

Please sign in to comment.