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

Add appropriate indentation when knit_print() stopping rule list #837

Merged

Conversation

fenguoerbian
Copy link
Contributor

Padding spaces to the beginning when knit_print()ing StoppingList so that nested StoppingList will have appropriate indent levels when rendered.

Fixes #836

R/helpers_knitr_Stopping.R Outdated Show resolved Hide resolved
R/helpers_knitr_Stopping.R Outdated Show resolved Hide resolved
R/helpers_knitr_Stopping.R Outdated Show resolved Hide resolved
@@ -108,6 +121,18 @@ test_that("knit_print.StoppingList works correctly", {
"- ≥ 20 patients dosed: If 20 or more participants have been treated.\n\n\n\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will also need to check that the HTML files in /testthat/snaps/helpers_knitr have updated correctly. They are created (and checked) at line 90 of /testthat/test-helpers_knitr.R.

This patch adjust the preamble of `knit_print()` output for `StoppingList`,
`StoppingAny` and `StoppingAll` according to the length of stop list.

For `StoppingList`, the premable is adjusted according to whether the length of
stop list is 1 or higher. And the wording "rule" or "rules" are used.

For `StoppingAny` and `StoppingAll`, the preamble is adjusted accroding to the
length of stop list being 1, 2 or more. And the wording "this"/"either"/"any" or
"this"/"both"/"all" and "rule"/"rules" are used accordingly.
@fenguoerbian
Copy link
Contributor Author

I've also updated this PR to address the nice-to-haves in #836

@Puzzled-Face
Copy link
Collaborator

I've also updated this PR to address the nice-to-haves in #836

Thank you. @danielinteractive I'm happy with this PR. Would you approve, please?

@fenguoerbian
Copy link
Contributor Author

fenguoerbian commented Jun 26, 2024

Just add some new testing code for knit_print() varying length stop lists

@danielinteractive
Copy link
Collaborator

here we cannot perform all the checks because it is a PR from a forked repo. Therefore merging

@danielinteractive danielinteractive merged commit 15a1353 into openpharma:main Jun 26, 2024
20 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add indentation when knit_print() stopping rule list
3 participants