brian-j-smith / MachineShop

MachineShop: R package of models and tools for machine learning
https://brian-j-smith.github.io/MachineShop/
62 stars 10 forks source link

Update to use print_step() instead of printer() in print methods #6

Closed EmilHvitfeldt closed 2 years ago

EmilHvitfeldt commented 2 years ago

Hello 👋

In the most recent CRAN release of {recipes}, we took the first step towards updating the printing infrastructure to use {cli}. This means that in order for your steps to print properly when the next version of {recipes} gets on CRAN, you will need to have adopted this change as well. Failure to do so won't result in errors, only malformed printing. The change itself is fairly minimal. Please see the following PR https://github.com/tidymodels/recipes/pull/871 for examples of how this change is to be done. Please let me know if you have any questions!

See example below:

# Old
print.step_pls <- function(x, width = max(20, options()$width - 35), ...) {
  cat("PLS feature extraction with ")
  printer(x$columns, x$terms, x$trained, width = width)
  invisible(x)
}

# New
print.step_pls <- function(x, width = max(20, options()$width - 35), ...) {
  title <- "PLS feature extraction with "
  print_step(x$columns, x$terms, x$trained, width = width, title = title)
  invisible(x)
}
brian-j-smith commented 2 years ago

Thanks for the update on print_step() and the usage example. This is now changed in the MachineShop package and will be in the next version.