-
-
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
Initial kmg01_1 #484
Initial kmg01_1 #484
Conversation
🧪 Code Coverage Summary
Diff against main
Results for commit: fb170f91f624b1490f18f691ebdea3a16fa47c87 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Create template from issue: 373 |
R/kmg01.R
Outdated
...) { | ||
anl <- adam_db[[dataset]] | ||
checkmate::assert_true(length(unique(anl$PARAMCD)) == 1) | ||
checkmate::assert_character(x_name) |
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 assert_string
R/kmg01.R
Outdated
} | ||
|
||
gkm_plot <- if (!show_statis) { | ||
g_km( |
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.
these two parts can be put together
R/kmg01.R
Outdated
checkmate::assert_class(adam_db, "dm") | ||
assert_colnames(adam_db[[dataset]], c("PARAMCD", "CNSR")) | ||
|
||
adam_db <- adam_db %>% |
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 list of data frames
R/kmg01.R
Outdated
#' @examples | ||
#' library(dplyr) | ||
#' | ||
#' col <- c( |
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 make it consistent with the argument passing from citril, we have to make it either a named list or unnamed 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.
Changed with list()
R/kmg01.R
Outdated
col <- line_col | ||
} | ||
|
||
gkm_plot <- g_km( |
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.
no need to assign it to gkm_plot
as it is returned directly
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.
Removed
…eering/chevron into 373_kmg01_template
R/utils.R
Outdated
@@ -266,3 +266,16 @@ gg_list <- function(...) { | |||
class = c("gg_list", "list") | |||
) | |||
} | |||
|
|||
#' Check to have only one PARAMCD in the analysis dataset |
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.
this assertion check put in assertions.R
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.
Moved
R/utils.R
Outdated
@@ -266,3 +266,16 @@ gg_list <- function(...) { | |||
class = c("gg_list", "list") | |||
) | |||
} | |||
|
|||
#' Check to have only one PARAMCD in the analysis dataset | |||
#' @param param_val unique value of PARAMCD |
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.
add type hint of the param_val (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.
Added
R/utils.R
Outdated
if (length(param_val) > 1) { | ||
stop(paste0( | ||
"More than one parameters:", | ||
paste(param_val, collapse = ", "), |
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 toString(param_val)
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.
Updated
R/utils.R
Outdated
#' @param param_val unique value of PARAMCD | ||
#' @export | ||
assert_only_one_paramcd <- function(param_val) { | ||
if (length(param_val) > 1) { |
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 for input values
R/utils.R
Outdated
stop(paste0( | ||
"More than one parameters:", | ||
paste(param_val, collapse = ", "), | ||
", Only one suppose to have." |
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.
after "," should not use up case
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.
updated
checkmate::assert_character(line_col, null.ok = TRUE) | ||
|
||
assert_colnames(adam_db[[dataset]], "AVAL") | ||
variables <- list(tte = "AVAL", is_event = "is_event", arm = 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.
this is not suitable to have "AVAL" and "is_event" fixed here. I would rather expose these two arguments. And, should not we use CNSR
here (0 for event and 1 for censor)
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.
Keep it for now
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.
but we should check if is_event
exists in data
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 also arm_var
R/assertions.R
Outdated
|
||
|
||
#' Check to have only one PARAMCD in the analysis dataset | ||
#' @param param_val (`character`) value of PARAMCD |
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.
since we don't require it to be a character (as factor also works), remove the type hint or at least check if it is character or factor, and correct the type hint
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, thank you
close insightsengineering/chevron-tasks#66