-
-
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
123 DMT01 sample data review #321
Conversation
🧪 Code Coverage Summary
Results for commit: 24601148da606faa1900e66668e36e0182edda4a Minimum allowed coverage is ♻️ This comment has been updated with latest results |
R/utils.R
Outdated
@@ -99,6 +99,10 @@ syn_test_data <- function() { | |||
) | |||
) | |||
sd$adex <- dunlin::cut_by_group(as.data.frame(sd$adex), "AVAL", "PARAM", group, "AVALCAT1") | |||
sd$adsl$AAGE <- sd$adsl$AGE | |||
attr(sd$adsl$AAGE, "label") <- "Age (yr)" | |||
sd$adsl$AGEGR1 <- cut(sd$adsl$AGE, c(0, 18, 200), c("<18", ">=18")) |
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.
we can change the default data to contain age group <65 and >= 65
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. Done!
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.
I still feel we should provide labels for AAGE and AGEGR1 as the user will always want to overwrite from default adsl
labels,
run(dmt01_1, adam_db = db, armvar="TRT01P", summaryvars = c("AAGE", "AGEGR1"), summaryvars_lbls= c("Age (yr)","Age group (yr)"))
@barnett11 thank you for the review. Default labels have been updated to reflect standard labels. |
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.
Looking great, thanks @BFalquet
R/dmt01.R
Outdated
summaryvars = c("AGE", "SEX", "COUNTRY", "RACE"), | ||
summaryvars_lbls = NULL, | ||
summaryvars = c("AAGE", "AGEGR1", "SEX", "ETHNIC", "RACE"), | ||
summaryvars_lbls = c("Age (yr)", "Age group (yr)", "Sex", "Ethnicity", "Race"), |
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.
I don't agree that we should provide these labels here. The thing is, if labels are provided as default, then when you supply the summaryvars other than AAGE and AGEGR1, you have to update the summaryvars_lbls otherwise there will 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.
example:
run(dmt01_1, syn_data, summaryvars = "AAGE")
Error in (function (adam_db, armvar = "ARM", summaryvars = c("AAGE", "AGEGR1", :
Assertion on 'length(summaryvars) == length(summaryvars_lbls)' failed: Must be TRUE.
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.
it just looks not good.
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.
@clarkliming I understand the objection, what about a named vector then ? e.g. summaryvars = c("Age (yo)" = "AGE")
and for the unnamed elements we collect the label from the data ? Or the summaryvars _lbls
could be a named vector with the same logic (but then it would be a bit redundant) summaryvars = c( "AGE"), summaryvars _lbls = c("Age (yo)" = "AGE")
.
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 discussion with @clarkliming and @barnett11 the first option has been selected for implementation.
R/utils.R
Outdated
summaryvars_lbls <- c() | ||
|
||
for (i in seq_along(x)) { | ||
res <- if (is.null(names(x[i])) || names(x[i]) == "") { |
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.
I think we can vectorize it; like
if (is.null(names(x)) {labels} else {if_else(names(x)== "", labels, names(x)}
of course names(x) should be executed outside
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!
close insightsengineering/chevron-tasks#53
close #322
thank you for the review