Skip to content

add a line ending to printed notes#558

Merged
topepo merged 3 commits into
mainfrom
better-notes
Oct 4, 2022
Merged

add a line ending to printed notes#558
topepo merged 3 commits into
mainfrom
better-notes

Conversation

@topepo

@topepo topepo commented Sep 30, 2022

Copy link
Copy Markdown
Member

For some notes, show_notes() would not properly break the lines:

library(tidymodels)
set.seed(1)
dat <- sim_classification(150, intercept = 15)
rs <- vfold_cv(dat)
fit_lr <- 
  logistic_reg() %>% 
  fit_resamples(
  class ~ .,
  rs,
  metrics = metric_set(accuracy, kap, recall, precision)
)
#> ! Fold01: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge
#> ! Fold02: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold03: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold04: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold05: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold06: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold07: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold08: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold09: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold10: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
show_notes(fit_lr)
#> unique notes:
#> ───────────────────────────────────
#> glm.fit: algorithm did not converge ───────────────────────────────────
#> glm.fit: algorithm did not converge, glm.fit: fitted probabilities numerically 0 or 1 occurred

Created on 2022-09-30 by the reprex package (v2.0.1)

For this new version:

library(tidymodels)
set.seed(1)
dat <- sim_classification(150, intercept = 15)
rs <- vfold_cv(dat)
fit_lr <- 
  logistic_reg() %>% 
  fit_resamples(
  class ~ .,
  rs,
  metrics = metric_set(accuracy, kap, recall, precision)
)
#> ! Fold01: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge
#> ! Fold02: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold03: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold04: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold05: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold06: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold07: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold08: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold09: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
#> ! Fold10: preprocessor 1/1, model 1/1: glm.fit: algorithm did not converge, glm.fit: fitted probabilities numer...
show_notes(fit_lr)
#> unique notes:
#> ───────────────────────────────────
#> glm.fit: algorithm did not converge 
#>  ───────────────────────────────────
#> glm.fit: algorithm did not converge, glm.fit: fitted probabilities numerically 0 or 1 occurred

Created on 2022-09-30 by the reprex package (v2.0.1)

@topepo topepo marked this pull request as ready for review September 30, 2022 21:24
Comment thread tests/testthat/test-notes.R Outdated
Comment thread tests/testthat/_snaps/notes.md Outdated
@topepo topepo merged commit 3bbdcfe into main Oct 4, 2022
@topepo topepo deleted the better-notes branch October 4, 2022 15:44
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants