Generates a table showing numbers of subjects and observations, stratifying by multiple categorical covariates.
Usage
pt_inventory_long(
data,
cols,
drop_miss = FALSE,
table = NULL,
summarize_all = TRUE,
all_name = "All data",
dv_col = "DV",
bq_col = find_bq_col(data),
id_col = "ID",
level_width = NULL
)
pt_data_inventory_long(
data,
cols,
drop_miss = FALSE,
table = NULL,
summarize_all = TRUE,
all_name = "All data",
dv_col = "DV",
bq_col = find_bq_col(data),
id_col = "ID",
level_width = NULL
)Arguments
- data
the data frame to summarize; the user should filter or subset so that
datacontains exactly the records to be summarized; pmtables will not add or remove rows prior to summarizingdata- cols
data columns containing discrete data items for grouped data inventory summaries.
- drop_miss
If
TRUE, thenMISSwill be dropped, but only when allMISSvalues are equal to zero.- table
a named list to use for renaming columns (see details and examples)
- summarize_all
if
TRUEthen a complete data summary will be appended to the bottom of the table whenstackedisFALSE.- all_name
a name to use for the complete data summary
- dv_col
Character name of
DVcolumn.- bq_col
Character name of
BQLcolumn; seefind_bq_col().- id_col
Character name of
IDcolumn.- level_width
width in
cmof thelevelcolumn, the left-most column containing the different levels of the discrete data items specified incols.
Examples
data <- pmt_first
tab <- pt_inventory_long(data, cols = c("FORMf", "SEXf", "RFf"))
tab$data
#> # A tibble: 10 × 8
#> var level Number.SUBJ Number.MISS Number.OBS Number.BQL Percent.OBS
#> <chr> <chr> <int> <int> <int> <int> <chr>
#> 1 FORMf "tablet" 130 1 121 8 76.1
#> 2 FORMf "capsule" 15 0 14 1 8.8
#> 3 FORMf "troche" 15 0 14 1 8.8
#> 4 SEXf "male" 80 1 73 6 45.9
#> 5 SEXf "female" 80 0 76 4 47.8
#> 6 RFf "normal" 130 1 121 8 76.1
#> 7 RFf "mild" 10 0 10 0 6.3
#> 8 RFf "moderate" 10 0 9 1 5.7
#> 9 RFf "severe" 10 0 9 1 5.7
#> 10 NULL "\\hline \\h… 160 1 149 10 93.7
#> # ℹ 1 more variable: Percent.BQL <chr>
