insightsengineering / formatters

A framework for creating listings of raw data that include specialized formatting, headers, footers, referential footnotes, and pagination.
https://insightsengineering.github.io/formatters/
Other
15 stars 6 forks source link

Extend examples and see also of sprintf_format function #269

Open martincadek opened 5 months ago

martincadek commented 5 months ago

Closes https://github.com/insightsengineering/formatters/issues/141

Related to https://github.com/insightsengineering/rtables/issues/611

github-actions[bot] commented 5 months ago

badge

Code Coverage Summary

Filename             Stmts    Miss  Cover    Missing
-----------------  -------  ------  -------  -------------------------------------------------------------------------------------------------------------------------------------------
R/format_value.R       194      12  93.81%   88, 104-111, 194, 306, 406, 417, 425
R/generics.R           105       7  93.33%   454, 466, 499, 528, 652-658
R/labels.R              55       7  87.27%   49, 55, 64, 105, 133, 142, 146
R/matrix_form.R        552      50  90.94%   103, 455-456, 544, 557-560, 579, 611, 705-706, 721-726, 756-759, 792-793, 825-826, 870, 1033, 1057-1079, 1121, 1172, 1175, 1179
R/mpf_exporters.R      238      19  92.02%   2, 90-92, 201, 241, 246, 429, 432, 438-441, 479, 551-554, 567
R/page_size.R           45       1  97.78%   172
R/pagination.R         634      49  92.27%   250, 302-305, 407-420, 582, 765-766, 787-797, 1000-1016, 1148, 1155, 1362-1363, 1375-1376, 1390-1391
R/tostring.R           586      49  91.64%   41, 93, 162, 196, 204, 240, 297-300, 393-397, 400-403, 410-415, 492, 631-632, 697-704, 761-765, 849, 864, 958, 1010, 1051, 1096, 1151, 1158
R/utils.R                3       0  100.00%
R/zzz.R                 17       6  64.71%   29-34
TOTAL                 2429     200  91.77%

Diff against main

Filename      Stmts    Miss  Cover
----------  -------  ------  --------
TOTAL             0       0  +100.00%

Results for commit: ba13221ba01c6e7fd4e36af128684900fe3bcc6f

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 5 months ago

Unit Tests Summary

  1 files    5 suites   9s :stopwatch:  43 tests  43 :white_check_mark: 0 :zzz: 0 :x: 295 runs  295 :white_check_mark: 0 :zzz: 0 :x:

Results for commit ba13221b.

:recycle: This comment has been updated with latest results.

martincadek commented 5 months ago

Check fails at library load which is required for the example. > library(rtables) Error in library(rtables) : there is no package called ‘rtables’

I believe the formatters won't import the package but I'll do further tests. If I am not able to use rtables I will use \dontrun{} wrapper.

In addition, this part of the issue is somewhat unclear to me '_It is also necessary imo to have a short explanation at the end of function call list_validformat* that explains the possibility to use dynamic function calls to set the format.'. The function list_valid_format_labels states "Currently valid format labels can not be added dynamically." Can you please provide what would you suggest adding @Melkiades. Thank you!

Melkiades commented 5 months ago

Check fails at library load which is required for the example. > library(rtables) Error in library(rtables) : there is no package called ‘rtables’

I believe the formatters won't import the package but I'll do further tests. If I am not able to use rtables I will use \dontrun{} wrapper.

Do not use rtables from formatters as it would result in circular dependencies

In addition, this part of the issue is somewhat unclear to me '_It is also necessary imo to have a short explanation at the end of function call list_validformat* that explains the possibility to use dynamic function calls to set the format.'. The function list_valid_format_labels states "Currently valid format labels can not be added dynamically." Can you please provide what would you suggest adding @Melkiades. Thank you!

This issue needs to have documentation for the various sprintf and round formats that we added or can add when format is a function. Indeed, you can use this to change everything that is printed out and we lack documentation for this powerful feature

Melkiades commented 5 months ago

@martincadek remember to run the styler from rstudio, so you avoid having annoying lintr issues ;)

martincadek commented 5 months ago

Thank you for the reviews so far - working on this to have it resolved today.

github-actions[bot] commented 4 months ago

CLA Assistant Lite bot ✅ All contributors have signed the CLA

martincadek commented 4 months ago

I have read the CLA Document and I hereby sign the CLA