abnormal_by_worst_grade_worsen | R Documentation |
Patient count and fraction for laboratory events (worsen from baseline) shift table.
count_abnormal_lab_worsen_by_baseline(
lyt,
var,
variables = list(id = "USUBJID", baseline_var = "BTOXGR", direction_var = "GRADDR"),
na_str = default_na_str(),
nested = TRUE,
...,
table_names = NULL,
.stats = NULL,
.formats = NULL,
.labels = NULL,
.indent_mods = NULL
)
s_count_abnormal_lab_worsen_by_baseline(
df,
.var = "ATOXGR",
variables = list(id = "USUBJID", baseline_var = "BTOXGR", direction_var = "GRADDR")
)
a_count_abnormal_lab_worsen_by_baseline(
df,
.var = "ATOXGR",
variables = list(id = "USUBJID", baseline_var = "BTOXGR", direction_var = "GRADDR")
)
lyt |
( |
variables |
(named
|
na_str |
( |
nested |
( |
... |
additional arguments for the lower level functions. |
table_names |
( |
.stats |
( |
.formats |
(named |
.labels |
(named |
.indent_mods |
(named |
df |
( |
.var , var |
( |
count_abnormal_lab_worsen_by_baseline()
returns a layout object suitable for passing to further layouting
functions, or to rtables::build_table()
. Adding this function to an rtable
layout will add formatted
rows containing the statistics from s_count_abnormal_lab_worsen_by_baseline()
to the table layout.
s_count_abnormal_lab_worsen_by_baseline()
returns the counts and fraction of patients whose worst
post-baseline lab grades are worse than their baseline grades, for post-baseline worst grades
"1", "2", "3", "4" and "Any".
a_count_abnormal_lab_worsen_by_baseline()
returns the corresponding list with
formatted rtables::CellValue()
.
count_abnormal_lab_worsen_by_baseline()
: Layout-creating function which can take statistics function
arguments and additional format arguments. This function is a wrapper for rtables::analyze()
.
s_count_abnormal_lab_worsen_by_baseline()
: Statistics function for patients whose worst post-baseline
lab grades are worse than their baseline grades.
a_count_abnormal_lab_worsen_by_baseline()
: Formatted analysis function which is used as afun
in count_abnormal_lab_worsen_by_baseline()
.
Relevant helper functions h_adlb_worsen()
and h_worsen_counter()
library(dplyr)
# The direction variable, GRADDR, is based on metadata
adlb <- tern_ex_adlb %>%
mutate(
GRADDR = case_when(
PARAMCD == "ALT" ~ "B",
PARAMCD == "CRP" ~ "L",
PARAMCD == "IGA" ~ "H"
)
) %>%
filter(SAFFL == "Y" & ONTRTFL == "Y" & GRADDR != "")
df <- h_adlb_worsen(
adlb,
worst_flag_low = c("WGRLOFL" = "Y"),
worst_flag_high = c("WGRHIFL" = "Y"),
direction_var = "GRADDR"
)
basic_table() %>%
split_cols_by("ARMCD") %>%
add_colcounts() %>%
split_rows_by("PARAMCD") %>%
split_rows_by("GRADDR") %>%
count_abnormal_lab_worsen_by_baseline(
var = "ATOXGR",
variables = list(
id = "USUBJID",
baseline_var = "BTOXGR",
direction_var = "GRADDR"
)
) %>%
append_topleft("Direction of Abnormality") %>%
build_table(df = df, alt_counts_df = tern_ex_adsl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.