Skip to content
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

Change solution for controlling tidymodels output width when fixed upstream #367

Open
ttimbers opened this issue Oct 27, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request low priority nice but not important or mandatory waiting for help

Comments

@ttimbers
Copy link
Contributor

We currently use this function to control the tidymodels output width:

print_tidymodels <- function(tidymodels_object) {
  if(!is_latex_output()) {
    tidymodels_object
  } else {
    output <- capture.output(tidymodels_object)
    
    for (i in seq_along(output)) {
      if (nchar(output[i]) <= 80) {
        cat(output[i], sep = "\n")
      } else {
        cat(str_sub(output[i], start = 1, end = 80), sep = "\n")
        cat(str_sub(output[i], start = 81, end = nchar(output[i])), sep = "\n")
      }
    }
  }
}

When we use it, we should set the code chunk options of the chunk where the object is being generated to results = 'hide', echo = TRUE and then the code chunk option of the chunk that calls that function to echo = FALSE.

For example:

Screen Shot 2021-10-26 at 11 09 34 PM

Although this works, it's not ideal. A better, long-term solution is for this to be fixed in tidymodels... I will open an issue in tidymodels and update our code once they fix this.

@trevorcampbell
Copy link
Contributor

trevorcampbell commented Jul 3, 2023

I will open an issue in tidymodels and update our code once they fix this.

@ttimbers where is this issue filed? Would be good to include a link to it here so we can keep track of it. I briefly looked in some of the tidymodels repos but couldn't find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority nice but not important or mandatory waiting for help
Projects
No open projects
Development

No branches or pull requests

2 participants