Note: The direction of the shift table for each lab test is based on metadata and NCI CTCAE specifications. In addition, the worst laboratory flags must be selected appropriately to match the direction of abnormality. For example, if any lab requires a shift table for both directions, then both worst_flag_low and worst_flag_high must be specified in h_adlb_worsen. If all labs requires a shift table for only one direction, then the matching worst lab flag variable must be selected in h_adlb_worsen.
WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
---title: LBT08subtitle: Laboratory Test Results with Highest NCI CTCAE Grade at Any Time---------------------------------------------------------------------------{{< include ../../_utils/envir_hook.qmd >}}```{r setup, echo = FALSE, warning = FALSE, message = FALSE}library(dplyr)library(tern)adsl <- random.cdisc.data::cadsladlb <- random.cdisc.data::cadlbadlb <- adlb %>% mutate( GRADDR = case_when( PARAMCD == "ALT" ~ "L", PARAMCD == "CRP" ~ "B", PARAMCD == "IGA" ~ "H" ) ) %>% filter(SAFFL == "Y" & ONTRTFL == "Y" & GRADDR != "")adsl <- df_explicit_na(adsl)adlb <- df_explicit_na(adlb)df <- h_adlb_worsen( adlb, worst_flag_low = c("WGRLOFL" = "Y"), worst_flag_high = c("WGRHIFL" = "Y"), direction_var = "GRADDR")attributes(df$GRADDR) <- list("label" = "Direction of Abnormality")``````{r include = FALSE}webr_code_labels <- c("setup")```{{< include ../../_utils/webr_no_include.qmd >}}## Output:::: panel-tabset## Standard TableNote: The direction of the shift table for each lab test is based on metadata and NCI CTCAE specifications. In addition, the worst laboratory flags must be selected appropriately to match the direction of abnormality. For example, if any lab requires a shift table for both directions, then both `worst_flag_low` and `worst_flag_high` must be specified in `h_adlb_worsen`. If all labs requires a shift table for only one direction, then the matching worst lab flag variable must be selected in `h_adlb_worsen`.::: {.panel-tabset .nav-justified group="webr"}## {{< fa regular file-lines sm fw >}} Preview```{r variant1, test = list(result_v1 = "result")}result <- basic_table(show_colcounts = TRUE) %>% split_cols_by("ARMCD") %>% split_rows_by("PARAMCD", label_pos = "topleft", split_label = obj_label(df$PARAMCD)) %>% split_rows_by("GRADDR", label_pos = "topleft", split_label = obj_label(df$GRADDR)) %>% count_abnormal_lab_worsen_by_baseline( var = "ATOXGR", variables = list( id = "USUBJID", baseline_var = "BTOXGR", direction_var = "GRADDR" ) ) %>% append_topleft(" Highest NCI CTCAE Grade") %>% build_table(df = df, alt_counts_df = adsl)result``````{r include = FALSE}webr_code_labels <- c("variant1")```{{< include ../../_utils/webr.qmd >}}:::## Data Setup```{r setup}#| code-fold: show```::::{{< include ../../_utils/save_results.qmd >}}{{< include ../../repro.qmd >}}