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

update ref_group column ordering #748

Merged
merged 4 commits into from
Oct 31, 2023
Merged

update ref_group column ordering #748

merged 4 commits into from
Oct 31, 2023

Conversation

clarkliming
Copy link
Contributor

close #747

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2023

badge

Code Coverage Summary

Filename                     Stmts    Miss  Cover    Missing
-------------------------  -------  ------  -------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
R/00tabletrees.R               737      62  91.59%   22, 103, 106, 413, 497-498, 501, 656, 756, 847-848, 949, 951-952, 975-978, 1000, 1113-1116, 1211-1216, 1363, 1458-1461, 1524-1527, 1562-1565, 1571-1576, 1625, 1632, 1730, 1840, 1854, 1857-1860, 1863-1866, 1894, 1925-1926
R/as_html.R                    138       6  95.65%   66, 133-137
R/colby_constructors.R         555      20  96.40%   71, 123, 181-184, 244-247, 387, 404, 1213, 1304, 1465, 1503, 1525, 1549, 1570, 1726
R/compare_rtables.R             83      17  79.52%   93-96, 99-102, 115-118, 137, 157-158, 189, 194
R/format_rcell.R                12       0  100.00%
R/indent.R                      13       2  84.62%   39-40
R/index_footnotes.R             62       0  100.00%
R/make_split_fun.R             119      23  80.67%   22-25, 51-54, 57-60, 115, 119, 280, 283-286, 291-294, 313, 412
R/make_subset_expr.R           136      14  89.71%   34-48, 126-133, 168, 250, 266, 274
R/simple_analysis.R              5       1  80.00%   55
R/split_funs.R                 505      66  86.93%   143, 148, 154-159, 164, 181-185, 366-371, 388-393, 474, 526, 544-547, 564, 631, 641-642, 644, 658, 702, 727, 903, 910, 936-939, 950-951, 953, 955, 1126-1128, 1142-1146, 1210-1213, 1276-1279
R/summary.R                    215      24  88.84%   38, 85, 192, 200, 271-276, 287-288, 307-308, 418, 465-481, 516, 549
R/tree_accessors.R             833      79  90.52%   109, 251, 269, 292, 330, 344, 360, 465, 492-493, 774-779, 907, 925, 949, 999, 1054-1055, 1094, 1127, 1163-1167, 1220, 1295-1299, 1317-1327, 1396, 1501-1504, 1529, 1549-1550, 1559, 1600, 1618-1622, 1643-1647, 1726, 1768, 1872, 1976, 1989, 2002, 2016, 2024, 2033-2037, 2379, 2737, 2850, 2944-2951, 3111, 3229, 3255-3289, 3305-3312
R/tt_afun_utils.R              411      32  92.21%   50, 164, 171, 181-194, 260, 271-272, 504, 512-515, 597-601, 622, 637-639
R/tt_compare_tables.R           70       4  94.29%   56, 178, 257, 261
R/tt_compatibility.R           510      56  89.02%   19, 142-143, 192, 197, 332-333, 337-340, 346, 350, 398, 520, 568, 601, 621, 654-657, 701, 718-722, 809, 837-840, 849, 912, 920, 931-934, 1044, 1051, 1080-1094, 1125-1126
R/tt_dotabulation.R           1116      96  91.40%   54, 252, 257, 259, 310, 334, 338-341, 373-376, 399, 434-437, 465-468, 564, 702-706, 757, 761, 790-793, 803, 823-827, 834-837, 1093, 1097, 1129, 1242-1245, 1439-1447, 1588, 1672-1681, 1761-1764, 1775, 1780, 1785-1786, 1788, 1799, 1804, 1827, 1922-1941
R/tt_export.R                  472      44  90.68%   48, 65, 105-109, 142, 181-185, 249-262, 365-368, 383, 711, 720, 745-749, 916-919, 922, 953, 959
R/tt_from_df.R                   9       0  100.00%
R/tt_paginate.R                436      37  91.51%   48, 73, 110-118, 393, 515-518, 538-542, 692-695, 745-752, 821, 824, 834, 841, 844
R/tt_pos_and_access.R          571      43  92.47%   77, 79-81, 106, 166, 212-216, 262, 514, 516, 524, 530, 544, 554-557, 739, 750-754, 759-762, 789, 842-843, 855, 1021-1022, 1080-1108, 1388, 1465
R/tt_showmethods.R             144      21  85.42%   60, 97-120, 183, 209, 218, 226, 229-233, 326-327
R/tt_sort.R                     88       5  94.32%   223-226, 234
R/tt_toString.R                394      25  93.65%   118, 309, 357, 372, 382, 389, 392, 398-408, 497, 562, 568, 803-829
R/utils.R                       23       0  100.00%
R/validate_table_struct.R       84      12  85.71%   79-83, 92-93, 140, 150-151, 204-205
R/Viewer.R                      61       9  85.25%   51, 55, 65-69, 89, 123
TOTAL                         7802     698  91.05%

Diff against main

Filename                     Stmts    Miss  Cover
-------------------------  -------  ------  --------
R/00tabletrees.R              +113     +21  -1.84%
R/as_html.R                    +50      -1  +3.61%
R/colby_constructors.R         +73      +3  -0.08%
R/compare_rtables.R             +5      +6  -6.38%
R/index_footnotes.R            +12       0  +100.00%
R/make_split_fun.R            +119     +23  +80.67%
R/make_subset_expr.R           +30      +2  +1.03%
R/split_funs.R                 +84     +11  -0.01%
R/summary.R                    +32      +8  -2.42%
R/tree_accessors.R             +40     +11  -0.91%
R/tt_afun_utils.R              +66      +7  -0.54%
R/tt_compare_tables.R           +5       0  +0.44%
R/tt_compatibility.R           +97      +6  +1.13%
R/tt_dotabulation.R           +379     +52  -2.63%
R/tt_export.R                 +243     -29  +22.56%
R/tt_paginate.R                +53     +22  -4.57%
R/tt_pos_and_access.R          +51      +6  -0.42%
R/tt_showmethods.R             +23       0  +2.77%
R/tt_sort.R                     +7      -1  +1.73%
R/tt_toString.R                +89      +3  +0.87%
R/utils.R                      +12      -1  +9.09%
R/validate_table_struct.R      +84     +12  +85.71%
R/Viewer.R                      +5       0  +1.32%
TOTAL                        +1672    +161  -0.19%

Results for commit: 8ca8ef5

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2023

Unit Tests Summary

       1 files       24 suites   2m 32s ⏱️
   186 tests    186 ✔️ 0 💤 0
1 410 runs  1 410 ✔️ 0 💤 0

Results for commit 8ca8ef5.

♻️ This comment has been updated with latest results.

@shajoezhu shajoezhu added the sme label Oct 16, 2023
@shajoezhu
Copy link
Collaborator

test snap changing at insightsengineering/scda.test#67

@Melkiades Melkiades self-requested a review October 16, 2023 08:06
@anajens anajens self-requested a review October 16, 2023 13:43
Copy link
Contributor

@anajens anajens left a comment

Choose a reason for hiding this comment

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

I think this is too big of a breaking change right before the release. All of tern and TLG-C examples using ref_group will be affected.

Ideally the ref_group column should continue to be placed first by default. We just need to offer support to users who do not wish to use the default.

@Melkiades
Copy link
Contributor

I think this is too big of a breaking change right before the release. All of tern and TLG-C examples using ref_group will be affected.

Ideally the ref_group column should continue to be placed first by default. We just need to offer support to users who do not wish to use the default.

I fully agree, I think it is better to give the possibility in tern to put the baseline somewhere else instead of the default

@clarkliming
Copy link
Contributor Author

after simple evaluation, the ref_group is not affecting many templates. 12 templates in tlg-catalogue contains the ref_group argument, and only one snapshot is affected (ratet01, using ARM B as the reference group). Others all using the first level of arm as reference (so not changing snapshots).

Honestly I think this change should happen much earlier. With this update more flexibility is introduced and we finally have a consistent way of working with columns. Now factor levels is the only thing that changes the column order.

@Melkiades
Copy link
Contributor

Melkiades commented Oct 16, 2023

after simple evaluation, the ref_group is not affecting many templates. 12 templates in tlg-catalogue contains the ref_group argument, and only one snapshot is affected (ratet01, using ARM B as the reference group). Others all using the first level of arm as reference (so not changing snapshots).

Honestly I think this change should happen much earlier. With this update more flexibility is introduced and we finally have a consistent way of working with columns. Now factor levels is the only thing that changes the column order.

I understand your point of view, but I think it is better to keep the standard like it is and then have a split_fun in tern that takes care of any possible change. Here, we added 3 ways to do this https://github.com/insightsengineering/tern/pull/1087/files. @anajens mentioned the possibility of having a lot of columns, in that case having the ref group as standard would be very useful, but I do not know if this is in line with the standards (also last is the same practically). Maybe @barnett11 can help us with this issue!

@barnett11
Copy link

Thanks @Melkiades, I would expect Control group to be either first or last, but fixing it one place could be difficult. The standards do not mandate that control arm must come first, so i think we should allow flexibility for this change in order as we do for all of our templates. It is common, and STREAM has allowed this flexibility to users for some time

@shajoezhu shajoezhu marked this pull request as draft October 17, 2023 14:28
@Melkiades
Copy link
Contributor

Just added blocked because I want to add the split functions at the same time so not to have changes in the TLG-c

@Melkiades Melkiades marked this pull request as ready for review October 27, 2023 15:03
@Melkiades Melkiades removed the blocked label Oct 27, 2023
@Melkiades
Copy link
Contributor

btw changing ref_group positioning is affecting all of these, it was not apparent because the ref_group is by chance the first group: Screenshot 2023-10-27 173235

@Melkiades Melkiades enabled auto-merge (squash) October 31, 2023 13:26
@Melkiades Melkiades merged commit d69bb8e into main Oct 31, 2023
17 checks passed
@Melkiades Melkiades deleted the 707_keep_order@main branch October 31, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Question]: How to make a custom split function to place reference group last
5 participants