Prepare data for general table display
Usage
tbl_processor(
datain,
dptlabel = NA,
statlabel = NA,
extra_df = NULL,
extra_mergeby = "DPTVAL",
dropvars = "",
keepvars = "",
disp_value_col = "Y",
addrowvars = NA_character_
)Arguments
- datain
Input dataframe
- dptlabel
Tilde-separated labels to set to category variables in data. eg: If analysis vars (
DPTVAR) containsAGEGR1, RACE;dptlabelmay be"Age Group~Race".- statlabel
Tilde-separated labels corresponding to each Statistic in data.
- extra_df
Additional dataframe, to merge with
datain.- extra_mergeby
Variables to merge
extra_dfby, if present.- dropvars
Variables additional to standard present in input data to be removed from output
- keepvars
Specific variables to be retained in report in addition to grouping and value columns. If
keepvarsis given it overridesdropvarsand the columns are located as last columns of the output.- disp_value_col
Hide/Show value column from the final display.
- addrowvars
Group Variable(s) to be removed as a column and instead used as row headers in the value column.
Examples
mentry_df <- adsl |>
mentry(
subset = NA_character_,
byvar = "ETHNIC/ETHNICN~BMIBLGR1",
trtvar = "TRT01A",
trtsort = "TRT01AN",
subgrpvar = "SEX",
trttotalyn = "N",
add_grpmiss = "N",
sgtotalyn = "N",
pop_fil = "SAFFL"
)
adsl_sum <- adsl_summary(
datain = mentry_df,
vars = "AGEGR1/AGEGR1N~AGE-S~RACE/RACEN"
) |>
display_bign_head(mentry_df)
#> mcatstat success
#> mcatstat success
#> msum success
tbl_processor(
datain = adsl_sum,
dptlabel = "Age Group~Age~Race",
statlabel = NA,
addrowvars = "DPTVAR"
)
#> # A tibble: 74 × 12
#> BYVAR1 BYVAR2 DPTVAL DPTVARN DPTVALN CN Placebo (N=86)_F (N=…¹
#> <chr> <chr> <chr> <int> <dbl> <chr> <chr>
#> 1 HISPANIC OR LATINO 25-<30 "Age … 1 0 NA NA
#> 2 HISPANIC OR LATINO 25-<30 "\t\t… 1 1 C 1 ( 1.16%)
#> 3 HISPANIC OR LATINO 25-<30 "\t\t… 1 2 C 0
#> 4 HISPANIC OR LATINO 25-<30 "Age" 2 0 NA NA
#> 5 HISPANIC OR LATINO 25-<30 "\t\t… 2 1 N 1
#> 6 HISPANIC OR LATINO 25-<30 "\t\t… 2 2 N (63.00,63.00)
#> 7 HISPANIC OR LATINO 25-<30 "\t\t… 2 3 N 63.00 (-)
#> 8 HISPANIC OR LATINO 25-<30 "\t\t… 2 4 N 63.00
#> 9 HISPANIC OR LATINO 25-<30 "\t\t… 2 5 N (63.00, 63.00)
#> 10 HISPANIC OR LATINO 25-<30 "Race" 3 0 NA NA
#> # ℹ 64 more rows
#> # ℹ abbreviated name: ¹`Placebo (N=86)_F (N=53)`
#> # ℹ 5 more variables: `Placebo (N=86)_M (N=33)` <chr>,
#> # `Xanomeline Low Dose (N=84)_F (N=50)` <chr>,
#> # `Xanomeline Low Dose (N=84)_M (N=34)` <chr>,
#> # `Xanomeline High Dose (N=84)_F (N=40)` <chr>,
#> # `Xanomeline High Dose (N=84)_M (N=44)` <chr>