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

Demographic table decimal places inconsistent with pilot 1 #54

Open
rpodcast opened this issue Nov 10, 2022 · 2 comments
Open

Demographic table decimal places inconsistent with pilot 1 #54

rpodcast opened this issue Nov 10, 2022 · 2 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@rpodcast
Copy link
Member

Per feedback from FDA: One minor point, the number of decimal places displayed in the demographic table isn’t always the same as in pilot 1.

@rpodcast rpodcast added the bug Something isn't working label Nov 10, 2022
@rpodcast rpodcast self-assigned this Nov 10, 2022
@rpodcast
Copy link
Member Author

While it was easy to locate the formatting syntax and update it to match the Pilot 1 demographics table script, I am very puzzled on how the table produced in Pilot 1 would strip out any zeros in the tenths or hundredths places in a numeric result for printing. For example, a value such as 76.00 is printed as 76 in the table. However, I cannot figure out how to achieve the same result with the same code in our app. I noticed that the version of {rtables} in Pilot 2's package library is version 0.5.12, while Pilot 1 used {rtables} version 0.3.8,

@rpodcast rpodcast added the help wanted Extra attention is needed label Nov 10, 2022
@Polkas
Copy link

Polkas commented Apr 11, 2023

The rtables package is based on the sprintf engine from the formatters package nowadays, so the trailing zeros are protected.

The rtables v0.3.8 is pre-formatters dependency era. In the past, the format worked like "xx.xx" = as.character(round(x, 2)) so the trailing zeros were not protected.
https://github.com/insightsengineering/rtables/blob/19a8320b0c7a7112ea07c0220356de15d5767ef3/R/format_rcell.R#L164

For the rtables v5.1.1.2 for formatting, there is used the formatters dependency engine based on sprintf.
That is why the trailing zeros are protected with the new rtables version. It is an improvement.
Please refer to
https://github.com/insightsengineering/formatters/blob/94d5e88878a3c45def00096098b2a4c7ecb44f87/R/format_value.R#L275 and https://github.com/insightsengineering/formatters/blob/94d5e88878a3c45def00096098b2a4c7ecb44f87/R/format_value.R#L163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants