Skip to content
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

130 DST01 sample data review #131

Merged
merged 3 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions R/dst01.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dst01_1 <- function(adam_db,
deco = std_deco("DST01"),
.study = list(
armvar = "ARM",
lbl_overall = "All patients",
lbl_overall = "All Patients",
disc_reason_var = "DCSREAS"
)) {
check_dst01_1_args(
Expand Down Expand Up @@ -147,7 +147,7 @@ dst01_1_lyt <- function(armvar = .study$armvar,
deco = std_deco("DST01"),
.study = list(
armvar = "ARM",
lbl_overall = "All patients",
lbl_overall = "All Patients",
status = "EOSSTT",
disc_reason_var = "DCSREAS"
)) {
Expand All @@ -161,25 +161,28 @@ dst01_1_lyt <- function(armvar = .study$armvar,
count_values(
vars = status,
values = completed_lbl,
.labels = c(count_fraction = "Completed Study")
.labels = c(count_fraction = "Completed Study"),
.formats = "xx (xx.x%)"
)

layout_table_other <-
layout_table %>%
count_values(
vars = status,
values = ongoing_lbl,
.labels = c(count_fraction = "Ongoing Study")
.labels = c(count_fraction = "Ongoing"),
.formats = "xx (xx.x%)"
) %>%
split_rows_by(
status,
split_fun = keep_split_levels(discontinued_lbl),
) %>%
summarize_row_groups(label_fstr = "Discontinued Study") %>%
summarize_row_groups(label_fstr = "Discontinued Study", format = "xx (xx.x%)") %>%
summarize_vars(
disc_reason_var,
.stats = "count_fraction",
denom = "N_col"
denom = "N_col",
formats = "xx (xx.x%)"
)

list(layout_table_completed, layout_table_other)
Expand Down Expand Up @@ -231,7 +234,7 @@ dst01_2 <- function(adam_db,
deco = std_deco("DST01"),
.study = list(
armvar = "ARM",
lbl_overall = "All patients",
lbl_overall = "All Patients",
disc_reason_var = "DCSREAS"
)) {
check_dst01_1_args(
Expand Down Expand Up @@ -316,7 +319,7 @@ dst01_2_lyt <- function(armvar = .study$armvar,
deco = std_deco("DST01"),
.study = list(
armvar = "ARM",
lbl_overall = "All patients",
lbl_overall = "All Patients",
status = "EOSSTT",
disc_reason_var = "DCSREAS"
)) {
Expand All @@ -329,14 +332,16 @@ dst01_2_lyt <- function(armvar = .study$armvar,
count_values(
vars = status,
values = completed_lbl,
.labels = c(count_fraction = "Completed Study")
.labels = c(count_fraction = "Completed Study"),
.formats = "xx (xx.x%)"
)

layout_table_other <- layout_table %>%
count_values(
vars = status,
values = ongoing_lbl,
.labels = c(count_fraction = "Ongoing Study")
.labels = c(count_fraction = "Ongoing"),
.formats = "xx (xx.x%)"
) %>%
split_rows_by(
var = status,
Expand All @@ -345,13 +350,14 @@ dst01_2_lyt <- function(armvar = .study$armvar,
summarize_row_groups(label_fstr = "Discontinued Study") %>%
split_rows_by(
"reasonGP",
split_fun = reorder_split_levels(neworder = c("Safety", "Non Safety"))
split_fun = reorder_split_levels(neworder = c("Safety", "Non-safety"))
) %>%
summarize_row_groups() %>%
summarize_row_groups(format = "xx (xx.x%)") %>%
summarize_vars(
disc_reason_var,
.stats = "count_fraction",
denom = "N_col"
denom = "N_col",
formats = "xx (xx.x%)"
)

list(completed = layout_table_completed, other = layout_table_other)
Expand Down Expand Up @@ -408,7 +414,7 @@ dst01_3 <- function(adam_db,
.study = list(
armvar = "ARM",
disc_reason_var = "DCSREAS",
lbl_overall = "All patients"
lbl_overall = "All Patients"
)) {
check_dst01_1_args(
reason = disc_reason_var,
Expand Down Expand Up @@ -515,7 +521,7 @@ dst01_3_lyt <- function(armvar = .study$armvar,
deco = std_deco("DST01"),
.study = list(
armvar = "ARM",
lbl_overall = "All patients",
lbl_overall = "All Patients",
status_treatment = "EOTSTT"
)) {
layout_table <- basic_table_deco(deco) %>%
Expand All @@ -526,18 +532,21 @@ dst01_3_lyt <- function(armvar = .study$armvar,
vars = status_treatment,
values = completed_lbl,
.labels = c(count_fraction = "Completed Treatment"),
.formats = "xx (xx.x%)",
table_names = c("COMPLETED")
) %>%
count_values(
vars = status_treatment,
values = ongoing_lbl,
.labels = c(count_fraction = "Ongoing Treatment"),
.formats = "xx (xx.x%)",
table_names = c("ONGOING")
) %>%
count_values(
vars = status_treatment,
values = discontinued_lbl,
.labels = c(count_fraction = "Discontinued Treatment"),
.formats = "xx (xx.x%)",
table_names = c("DISCONTINUED")
)
}
2 changes: 1 addition & 1 deletion R/standard_data_preprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ mutate_adsl_gp <- function(adam_db,
mutate(reasonGP = case_when(
!!sym_reason %in% c("ADVERSE EVENT", "DEATH") ~ "Safety",
!!sym_reason == "<Missing>" ~ "<Missing>",
TRUE ~ "Non Safety"
TRUE ~ "Non-safety"
)) %>%
dm_update_zoomed()
}
Expand Down
4 changes: 2 additions & 2 deletions man/dst01_1.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dst01_2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/dst01_3.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.