The input data gets processed based on TRT
, BY
and/or SUBGROUP
variables and filtered by
subset conditions. This processed data flows into categorical and numerical utilities such as
mcatstat()
and msumstat()
for further analysis.
Usage
mentry(
datain,
subset = NA,
byvar = NA,
subgrpvar = NA,
trtvar = NA,
trtsort = NA,
trttotalyn = "N",
trttotlabel = "Total",
trtmissyn = "N",
sgtotalyn = "N",
add_grpmiss = "N",
pop_fil = "Overall Population"
)
Arguments
- datain
Input dataset can be any
ADaM
data.- subset
Subset conditions for analysis of dependent variable.
- byvar
Tilde(
~
) separated strings for grouping variable names. Assigns toBYVAR1, BYVAR2
, etc. Use'/'
to specify ordering variables. eg:SEX/SEXN~COUNTRY
.`- subgrpvar
Tilde(
~
) separated strings for grouping variable names. Assigns toSUBGRPVAR1
,SUBGRPVAR2
, etc. Use'/'
to specify ordering variables. eg:RACE/RACEN~ETHNIC
.- trtvar
Treatment variable name string assigned as
TRTVAR
.- trtsort
Treatment sorting variable name string - numeric or character variable assigned as
TRTSORT
.- trttotalyn
Add total treatment values to be displayed as column in table or category in plot (
"Y"/"N"
).- trttotlabel
Label for total Treatment column/group
- trtmissyn
Retain Missing treatment counts in Total (if
trttotalyn
= Y). Missing treatment will not be considered as a column in analysis in any case.- sgtotalyn
Add total subgroup values to be displayed as column in table or category in plot (
"Y"/"N"
).- add_grpmiss
Add row or column for missing category in grouping variables. (
"Y"/"N"
)- pop_fil
Population Filter for data set: Name of flag variable. eg:
"SAFFL"
,"EFFFL"
orNA
for Overall Population.
Details
By Variable Processing Identify
byvars
if byvar is given, createBYVAR1
,BYVAR2
, etc. Check for numeric code list variable for the grouping var, if not create numeric variable for sorting asBYVAR1N
,BYVAR2N
etc. Convert tocharacter
ifnumeric
. Re-code blanks from grouping variables as"Missing"
Remove missing category value from grouping variable per user choice.Treatment Variable Processing Identify Treatment Variable, treatment sorting variable. Remove non treatment values. If treatment sort variable doesn't exist, make it same as
TRTVAR
If treatment sort is not numeric, convert to numeric Add treatment total column based ontrttotalyn
ConvertTRTVAR
to a factor in same order asTRTSORT
Subgroup Variable processing Identify Subgroup variable: create
SUBGRPVAR1N
,SUBGRPVAR2N
etc ifsubgrpvar
is specified. Check presence of numeric code list variables for the subgroup variables, if not create numeric variable for sorting purpose asSUBGRPVAR1N
etc Re-code blanks from By and Subgroup vars asMissing
Remove missing category value from grouping variable per user choice Add Subgroup total column for the last subgroup variableSubset Processing Applying population subset selected Applying denominator/overall subset condition passed by the user Applying analysis subset condition passed by the user
Calculate Big N for displaying in final output
data.frame
with CountN
for each treatment/subgroup if they exist. If noBig N
required, thenNA
is returned.
Examples
data(adsl)
df_mentry <-
adsl |> mentry(
subset = "EFFFL=='Y'",
byvar = "SEX/SEXN~AGEGR1",
trtvar = "TRT01A",
trtsort = "TRT01AN",
subgrpvar = "RACE/RACEN~BMIBLGR1",
trttotalyn = "N",
add_grpmiss = "N",
sgtotalyn = "N",
pop_fil = "Overall Population"
)
df_mentry
#> # A tibble: 234 × 58
#> STUDYID USUBJID SUBJID SITEID SITEGR1 ARM TRT01P TRT01PN TRT01A TRT01AN
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl>
#> 1 CDISCPILOT… 01-701… 1015 701 701 Plac… Place… 0 Place… 0
#> 2 CDISCPILOT… 01-701… 1023 701 701 Plac… Place… 0 Place… 0
#> 3 CDISCPILOT… 01-701… 1028 701 701 Xano… Xanom… 81 Xanom… 81
#> 4 CDISCPILOT… 01-701… 1033 701 701 Xano… Xanom… 54 Xanom… 54
#> 5 CDISCPILOT… 01-701… 1034 701 701 Xano… Xanom… 81 Xanom… 81
#> 6 CDISCPILOT… 01-701… 1047 701 701 Plac… Place… 0 Place… 0
#> 7 CDISCPILOT… 01-701… 1097 701 701 Xano… Xanom… 54 Xanom… 54
#> 8 CDISCPILOT… 01-701… 1111 701 701 Xano… Xanom… 54 Xanom… 54
#> 9 CDISCPILOT… 01-701… 1115 701 701 Xano… Xanom… 54 Xanom… 54
#> 10 CDISCPILOT… 01-701… 1118 701 701 Plac… Place… 0 Place… 0
#> # ℹ 224 more rows
#> # ℹ 48 more variables: TRTSDT <date>, TRTEDT <date>, TRTDUR <dbl>, AVGDD <dbl>,
#> # CUMDOSE <dbl>, AGE <dbl>, AGEGR1 <chr>, AGEGR1N <dbl>, AGEU <chr>,
#> # RACE <chr>, RACEN <dbl>, SEX <chr>, ETHNIC <chr>, SAFFL <chr>, ITTFL <chr>,
#> # EFFFL <chr>, COMP8FL <chr>, COMP16FL <chr>, COMP24FL <chr>, DISCONFL <chr>,
#> # DSRAEFL <chr>, DTHFL <chr>, BMIBL <dbl>, BMIBLGR1 <chr>, HEIGHTBL <dbl>,
#> # WEIGHTBL <dbl>, EDUCLVL <dbl>, DISONSDT <date>, DURDIS <dbl>, …