-
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
761 better getter seeters@221 fix separator div@main #782
761 better getter seeters@221 fix separator div@main #782
Conversation
…div@main Signed-off-by: Davide Garolini <[email protected]>
Code Coverage Summary
Diff against main
Results for commit: 877745a Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! I think this would cover a wide variety of use cases if people want to use section dividers, but is there any way to produce this table:
all obs
————————————————————————
A: Drug X
A
Mean 32.53
B
Mean 35.46
C
Mean 36.34
------------------------
B: Placebo
A
Mean 32.30
B
Mean 32.42
C
Mean 34.45
------------------------
C: Combination
A
Mean 35.76
B
Mean 34.39
C
Mean 33.54
I feel like this would be the most typical implementation by basic users.
Co-authored-by: Emily de la Rua <[email protected]> Signed-off-by: Davide Garolini <[email protected]>
@@ -647,7 +646,8 @@ AnalyzeVarSplit <- function(var, | |||
extra_args = list(), | |||
indent_mod = 0L, | |||
label_pos = "default", | |||
cvar = "") { | |||
cvar = "", | |||
section_div = NA_character_) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it is possible to do it also in analyze
contdf <- make_row_df(content_table(tt), | ||
ct_tt <- content_table(tt) | ||
cind <- indent + indent_mod(ct_tt) | ||
trailing_section_div(ct_tt) <- trailing_section_div(tt_labelrow(tt)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As section_div setter is based solely on labelrow and datarow, this fixes the contentRow case
tests/testthat/test-accessors.R
Outdated
return(grepl(regex, element)) | ||
} | ||
|
||
test_structure_with_a_getter <- function(tbl, getter, val_per_lev) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helper function to check we are doing the right thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to check vs structure
basic_table() %>%
split_rows_by("ARM", section_div = "-") %>%
split_rows_by("STRATA1") %>%
analyze("BMRKR1") %>%
build_table(DM) Can you please see if section_div getter and setter work fine for you? :) |
…div@main Signed-off-by: Davide Garolini <[email protected]>
…f github.com:Roche/rtables into 761_better_getter_seeters@221_fix_separator_div@main
Hi Davide, Thanks for the example code - I think my test code was getting too complicated and I missed that somehow. A couple of questions/comments on the getters/setters: I'll use this table code for examples: t <- basic_table() %>%
split_rows_by("ARM") %>%
split_rows_by("STRATA1") %>%
analyze("BMRKR1") %>%
build_table(DM)
E.g. header_section_div(t) <- "~"
t
Other than that the getters/setters are all working correctly for me! |
Thanks for trying it out Emily!
|
@edelarua 1. Is done. I added as default that if you add only one value, you have it for all levels. Let me know if only the first split/section should have it. You can do that anyway like this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new behaviour is great, thanks for implementing that!! Everything seems to be working as expected for me, and the warning messages are very informative. I reviewed the documentation as well and just added some minor suggestions for grammar fixes/typos.
Excellent work!!! :)
Co-authored-by: Emily de la Rua <[email protected]> Signed-off-by: Davide Garolini <[email protected]>
Co-authored-by: Emily de la Rua <[email protected]> Signed-off-by: Davide Garolini <[email protected]>
Co-authored-by: Emily de la Rua <[email protected]> Signed-off-by: Davide Garolini <[email protected]>
Co-authored-by: Emily de la Rua <[email protected]> Signed-off-by: Davide Garolini <[email protected]>
Co-authored-by: Emily de la Rua <[email protected]> Signed-off-by: Davide Garolini <[email protected]>
Fixes #761 #762. Somehow close to #509
makes
but if there are multiple analyze it does not print anything. These options differ, but it should print something in those cases.