healthcareai-r icon indicating copy to clipboard operation
healthcareai-r copied to clipboard

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

Open EmilHvitfeldt opened this issue 2 years ago • 0 comments

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)
}

EmilHvitfeldt avatar Feb 22 '22 05:02 EmilHvitfeldt