Skip to content

Commit

Permalink
Update PKCT01 timepoint variable (#134)
Browse files Browse the repository at this point in the history
Closes #133 

Merge after insightsengineering/tern#1095

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
edelarua and github-actions[bot] authored Oct 18, 2023
1 parent a5e0d83 commit 7a5d873
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 69 deletions.
14 changes: 8 additions & 6 deletions book/tables/pharmacokinetic/pkct01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ adpc <- synthetic_cdisc_dataset("latest", "adpc") %>%
adpc_1 <- adpc %>%
mutate(
NFRLT = as.factor(NFRLT),
AVALCAT1 = as.factor(AVALCAT1)
AVALCAT1 = as.factor(AVALCAT1),
NOMTPT = as.factor(paste(NFRLT, "/", PCTPT))
) %>%
select(NFRLT, ACTARM, VISIT, AVAL, PARAM, AVALCAT1) %>%
var_relabel(NFRLT = "Nominal Time from First Dose (hr)")
select(NOMTPT, ACTARM, VISIT, AVAL, PARAM, AVALCAT1)
adpc_1$NOMTPT <- factor(adpc_1$NOMTPT, levels = levels(adpc_1$NOMTPT)[order(as.numeric(gsub(".*?([0-9\\.]+).*", "\\1", levels(adpc_1$NOMTPT))))])
# Row structure
lyt_rows <- basic_table() %>%
Expand All @@ -47,9 +49,9 @@ lyt_rows <- basic_table() %>%
label_pos = "topleft"
) %>%
split_rows_by(
var = "NFRLT",
var = "NOMTPT",
split_fun = drop_split_levels,
split_label = obj_label(adpc_1$NFRLT),
split_label = "Nominal Time (hr) / Timepoint",
label_pos = "topleft",
child_labels = "hidden"
)
Expand All @@ -70,7 +72,7 @@ lyt <- lyt_rows %>%
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",
na_str = "NE",
.aligns = "decimal"
)
Expand Down
Loading

0 comments on commit 7a5d873

Please sign in to comment.