-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add rspt01 template #497
Add rspt01 template #497
Conversation
Signed-off-by: Teninq <[email protected]>
🧪 Code Coverage Summary
Diff against main
Results for commit: f7fcbab3943aed5cea631edec2eb5d7a8cd1640f Minimum allowed coverage is ♻️ This comment has been updated with latest results |
R/rspt01.R
Outdated
#' @param dataset (`string`) the name of a table in the `adam_db` object. | ||
#' @param ref_group (`string`) The name of the reference group, the value should | ||
#' be identical to the values in `arm_var`, if not speficied, it will by default | ||
#' use the first level of. |
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.
#' use the first level of. | |
#' use the first level or value of `arm_var`. |
R/rspt01.R
Outdated
checkmate::assert_flag(odds_ratio) | ||
checkmate::assert_flag(strat_analysis) | ||
|
||
arm_level <- unique(anl[[arm_var]]) |
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.
reference
Line 298 in a91d363
lvls <- function(x) { |
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.
usually it will be a factor
R/rspt01.R
Outdated
} | ||
} else { | ||
lyt02 <- basic_table(show_colcounts = TRUE) %>% | ||
split_cols_by(var = "ARM", ref_group = "A: Drug X") %>% |
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.
ref_group =
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.
and ideally we don't need to repeat that whole part of layout.
R/rspt01.R
Outdated
#' @param strat_analysis (`flag`) should the stratified analysis be performed, | ||
#' | ||
#' @export | ||
proportion_lyt <- function(lyt, arm_var, methods, strata, conf_level, odds_ratio = TRUE, strat_analysis = FALSE) { |
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.
strat_analysis
is dependent on strata
. If strat_analysis = TRUE
but strata
is null there could be issues.
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.
Do you think we should remove the strat_analysis
argument and use strata
only? Or we add an assertion
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.
for this function I do think we should remove the strata_analysis argument.
R/rspt01.R
Outdated
estimate_odds_ratio( | ||
vars = "is_rsp", | ||
variables = if (!strat_analysis) list(strata = NULL, arm = NULL) else list(strata = strata, arm = arm_var), | ||
table_names = if (!strat_analysis) "est_or" else "est_or_strat" |
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.
will it be easier if we use paste("est_or", suf, sep = "_")
where suf = "strat" ? just an idea. very very minor and please ignore if not suitable
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.
Good idea, but I prefer to align with other places to be easily understood.
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.
looks good to me. thanks
checkmate::assert_string(ref_group, null.ok = TRUE) | ||
checkmate::assert_flag(odds_ratio) | ||
checkmate::assert_subset(perform_analysis, c("unstrat", "strat")) | ||
|
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.
check strata
here (early is better than late)
checkmate::assert_character(strata, null.ok = !"stata" %in% perform_analysis) |
R/rspt01.R
Outdated
proportion_lyt( | ||
arm_var = arm_var, | ||
odds_ratio = odds_ratio, | ||
strata = strata1, |
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.
strata = strata1, | |
if (perform == "strat") strata |
this should work
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.
looks good to me, thank you
close #471