Skip to content

Commit

Permalink
Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif committed Sep 25, 2023
1 parent fd757ef commit 7f56518
Showing 1 changed file with 0 additions and 134 deletions.
134 changes: 0 additions & 134 deletions book/tables/pharmacokinetic/pkct01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,140 +10,6 @@ subtitle: Summary Concentration Table
::: panel-tabset
## Data Setup

```{r setup, message=FALSE}
#| code-fold: show
library(scda)
library(dplyr)
library(tern)
adsl <- synthetic_cdisc_dataset("latest", "adsl") %>%
filter(ACTARM == "A: Drug X")
adpc <- synthetic_cdisc_dataset("latest", "adpc") %>%
filter(ACTARM == "A: Drug X", PARAM == "Plasma Drug X")
# Setting up the data
adpc_1 <- adpc %>%
mutate(
NFRLT = as.factor(NFRLT),
AVALCAT1 = as.factor(AVALCAT1)
) %>%
select(NFRLT, ACTARM, VISIT, AVAL, PARAM, AVALCAT1) %>%
var_relabel(NFRLT = "Nominal Time from First Dose (hr)")
# Row structure
lyt_rows <- basic_table() %>%
split_rows_by(
var = "ACTARM",
split_fun = drop_split_levels,
split_label = "Treatment Group",
label_pos = "topleft"
) %>%
add_rowcounts(alt_counts = TRUE) %>%
split_rows_by(
var = "VISIT",
split_fun = drop_split_levels,
split_label = "Visit",
label_pos = "topleft"
) %>%
split_rows_by(
var = "NFRLT",
split_fun = drop_split_levels,
split_label = obj_label(adpc_1$NFRLT),
label_pos = "topleft",
child_labels = "hidden"
)
```

## Standard Table (Stats in Columns)

```{r variant1, test = list(result_v1 = "result")}
lyt <- lyt_rows %>%
analyze_vars_in_cols(
vars = c("AVAL", "AVALCAT1", rep("AVAL", 8)),
.stats = c("n", "n_blq", "mean", "sd", "cv", "geom_mean", "geom_cv", "median", "min", "max"),
.formats = c(
n = "xx.", n_blq = "xx.", mean = format_sigfig(3), sd = format_sigfig(3), cv = "xx.x", median = format_sigfig(3),
geom_mean = format_sigfig(3), geom_cv = "xx.x", min = format_sigfig(3), max = format_sigfig(3)
),
.labels = c(
n = "n", n_blq = "Number\nof\nLTRs/BLQs", mean = "Mean", sd = "SD", cv = "CV (%) Mean",
geom_mean = "Geometric Mean", geom_cv = "CV % Geometric Mean", median = "Median", min = "Minimum", max = "Maximum"
),
na_level = "NE",
.aligns = "decimal"
)
result <- build_table(lyt, df = adpc_1, alt_counts_df = adsl) %>% prune_table()
# Decorating
main_title(result) <- "Summary of PK Concentrations by Nominal Time and Treatment: PK Evaluable"
subtitles(result) <- c("Protocol: xxxxx", paste("Analyte: ", unique(adpc_1$PARAM)), paste("Treatment:", unique(adpc_1$ACTARM)))
main_footer(result) <- "NE: Not Estimable"
result
```

## Table Implementing 1/3 Imputation Rule

```{r variant2, test = list(result_v2 = "result")}
lyt <- lyt_rows %>%
analyze_vars_in_cols(
vars = c("AVAL", "AVALCAT1", rep("AVAL", 8)),
.stats = c("n", "n_blq", "mean", "sd", "cv", "geom_mean", "geom_cv", "median", "min", "max"),
.formats = c(
n = "xx.", n_blq = "xx.", mean = format_sigfig(3), sd = format_sigfig(3), cv = "xx.x", median = format_sigfig(3),
geom_mean = format_sigfig(3), geom_cv = "xx.x", min = format_sigfig(3), max = format_sigfig(3)
),
.labels = c(
n = "n", n_blq = "Number\nof\nLTRs/BLQs", mean = "Mean", sd = "SD", cv = "CV (%) Mean",
geom_mean = "Geometric Mean", geom_cv = "CV % Geometric Mean", median = "Median", min = "Minimum", max = "Maximum"
),
imp_rule = "1/3",
.aligns = "decimal"
)
result <- build_table(lyt, df = adpc_1, alt_counts_df = adsl) %>% prune_table()
# Decorating
main_title(result) <- "Summary of PK Concentrations by Nominal Time and Treatment: PK Evaluable"
subtitles(result) <- c("Protocol: xxxxx", paste("Analyte: ", unique(adpc_1$PARAM)), paste("Treatment:", unique(adpc_1$ACTARM)))
main_footer(result) <- c("NE: Not Estimable", "ND: Not Derived")
result
```

## Table Implementing 1/2 Imputation Rule

```{r variant3, test = list(result_v3 = "result")}
lyt <- lyt_rows %>%
analyze_vars_in_cols(
vars = c("AVAL", "AVALCAT1", rep("AVAL", 8)),
.stats = c("n", "n_blq", "mean", "sd", "cv", "geom_mean", "geom_cv", "median", "min", "max"),
.formats = c(
n = "xx.", n_blq = "xx.", mean = format_sigfig(3), sd = format_sigfig(3), cv = "xx.x", median = format_sigfig(3),
geom_mean = format_sigfig(3), geom_cv = "xx.x", min = format_sigfig(3), max = format_sigfig(3)
),
.labels = c(
n = "n", n_blq = "Number\nof\nLTRs/BLQs", mean = "Mean", sd = "SD", cv = "CV (%) Mean",
geom_mean = "Geometric Mean", geom_cv = "CV % Geometric Mean", median = "Median", min = "Minimum", max = "Maximum"
),
imp_rule = "1/2",
.aligns = "decimal"
)
result <- build_table(lyt, df = adpc_1, alt_counts_df = adsl) %>% prune_table()
# Decorate table
main_title(result) <- "Summary of PK Concentrations by Nominal Time and Treatment: PK Evaluable"
subtitles(result) <- c("Protocol: xxxxx", paste("Analyte: ", unique(adpc_1$PARAM)), paste("Treatment:", unique(adpc_1$ACTARM)))
main_footer(result) <- "ND: Not Derived"
result
```

{{< include ../../test-utils/save_results.qmd >}}

## `teal` App

```{r teal, message=FALSE, opts.label='skip_if_testing'}
Expand Down

0 comments on commit 7f56518

Please sign in to comment.