-
Notifications
You must be signed in to change notification settings - Fork 50
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
section_div in single var analyze call puts divider between each row generated by afun, rather than only after the last one #863
Comments
Hi @Melkiades @shajoezhu, I'm not sure who originally put in the sometimes First off, let me say that wanting to put dividers between rows generated by an afun is a good feature. That said, please consider reverting this behavior for the reasons below. After that I will lay out a couple of ways to give that ability to users which I think are better. Case for changing the behavior
Proposed new behaviorFor these reasons I feel that FeasibilityDavide you mentioned that getting the desired behavior requires analyze calls to know about eachother. Thats not entirely true if the meaning of section_div is fixed as proposed above. That said, analyze calls do "know about eachother" in that repeated analyze calls (without nested = FALSE) are combined at the layout stage into an rtables/R/colby_constructors.R Lines 1118 to 1119 in b16e0be
So to the extent we need to unify the divider behavior we can. That said, I think it would be entirely reasonable to just let each analyze call control only the divider that directly follows the block of rows it creates, so if you have 3 analyze calls you'd need at least the first 2 of them to set section_div (the third would be unnecessary if the split they are within has section_div set...). This gives the user complete control over even the corner cases where they want section dividers between some but not all of the sibling analyze sections, at a mild cost to convenience. I think it would also be reasonable to take the first non-NA section_div value from one of the individual Row divider behaviorIn as much as dividers between each row are desirable (again I'm not certain if that behavior is originally a bug by me that you assumed was intentional, or was intentionally implemented by you), I'd propose two ways of allowing the user to get that behavior:
The one or both of above will retain the ability to set dividers between individual rows without having the problems I described above. As an aside here, it is likely a good idea to change the name of the If we allow row dividers, we just have to make sure that for the last row, the row divider is overridden by the relevant section divider (probably even if said section_div value is even if it is NA) for the last row in an analyze section, which is inline with section_div behavior elsewhere, where the highest level section divider that applies is the only one that is used (e.g., if you split by Let me know if you anything is unclear or if you want to discuss more. Happy to meet if thats easier. |
ping @Melkiades @shajoezhu |
Thanks Gabe, hi @Melkiades @khatril , i think we can have a look at this and discuss potential breaking change this may lead to, and assess this We will need to assess at tlg-c, biomarker-c, scda.test and chevron @BFalquet for the use of this argument, and what sort of breaking change this will lead to . |
gives us
Instead of what it should generate, which is:
Note when analyze is given multiple variables, we get the desired behavior:
gives us
Multiple calls to
analyze
also result in the buggy behavior:gives
Its a little less clear what the correct behavior is here but only in terms of whether the second analyze call should inherit the section_div or not. Either way, section div should only place lines after sections.
I was going to prepare a patch but it appears the meaning of section divider has deviated drastically from its original usage so more discussion may be needed
The text was updated successfully, but these errors were encountered: