Skip to content

Commit

Permalink
Update RMPT templates to use analyze function (#45)
Browse files Browse the repository at this point in the history
Closes #44
  • Loading branch information
edelarua authored May 17, 2023
1 parent bb2bbcf commit 397a6ea
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 29 deletions.
9 changes: 4 additions & 5 deletions tables/other/rmpt01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ lyt <- basic_table(
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("aval_months_cat", label_pos = "topleft", split_label = "Duration of exposure") %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "aval_months_cat",
col_split = FALSE
)
) %>%
append_topleft(c("", "Duration of exposure"))
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)
result
Expand Down Expand Up @@ -176,5 +176,4 @@ shinyApp(app$ui, app$server)
```

{{< include ../../si.qmd >}}

:::
25 changes: 11 additions & 14 deletions tables/other/rmpt03.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ lyt <- basic_table(
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("AGEGR1", label_pos = "topleft", split_label = "Age group (years)") %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "AGEGR1",
col_split = FALSE
)
) %>%
append_topleft(c("", "Age group (years)"))
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)
result
```

## Table Modifying Age Groups
## Table Excluding Empty Age Groups

```{r}
lyt <- basic_table(
Expand All @@ -98,16 +98,14 @@ lyt <- basic_table(
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("AGEGR2",
split_fun = drop_split_levels, # "< 18" dropped
label_pos = "topleft", split_label = "Age group (years)"
) %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "AGEGR2",
col_split = FALSE
)
) %>%
append_topleft(c("", "Age group (years)"))
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f) %>%
prune_table()
result
```

Expand Down Expand Up @@ -225,5 +223,4 @@ shinyApp(app$ui, app$server)
```

{{< include ../../si.qmd >}}

:::
9 changes: 4 additions & 5 deletions tables/other/rmpt04.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ lyt <- basic_table(
.labels = c(n_patients = "Number of Patients", sum_exposure = "Patient Time*"),
custom_label = "Total Number of Patients and Patient Time"
) %>%
split_rows_by("ETHNIC", label_pos = "topleft", split_label = "Ethnicity") %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "ETHNIC",
col_split = FALSE
)
) %>%
append_topleft(c("", "Ethnicity"))
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)
result
Expand Down Expand Up @@ -137,5 +137,4 @@ shinyApp(app$ui, app$server)
```

{{< include ../../si.qmd >}}

:::
9 changes: 4 additions & 5 deletions tables/other/rmpt05.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ lyt <- basic_table(
var = "AVAL", col_split = TRUE,
.labels = c(n_patients = "Patients", sum_exposure = "Person time*")
) %>%
split_rows_by("RACE", label_pos = "topleft", split_label = obj_label(adex$RACE)) %>%
summarize_patients_exposure_in_cols(
var = "AVAL",
analyze_patients_exposure_in_cols(
var = "RACE",
col_split = FALSE
)
) %>%
append_topleft(c("", obj_label(adex$RACE)))
result <- build_table(lyt, df = anl, alt_counts_df = adsl_f)
result
Expand Down Expand Up @@ -143,5 +143,4 @@ shinyApp(app$ui, app$server)
```

{{< include ../../si.qmd >}}

:::

0 comments on commit 397a6ea

Please sign in to comment.