cat_data.Rd
Summarize categorical data
cat_data(
data,
cols,
by = ".total",
panel = by,
summarize_all = TRUE,
all_name = "All",
wide = FALSE,
nby = NULL
)
the data frame to summarize; the user should filter or subset
so that data
contains exactly the records to be summarized; pmtables will
not add or remove rows prior to summarizing data
the columns to summarize; may be character vector or quosure
a grouping variable; may be character vector or quosure
data set column name to stratify the summary
logical indicating whether or not to include a summary of the full data in the output
label for full data summary
logical
; if TRUE
, data frame will be returned in wide format;
if FALSE
, it will be returned in long
format
number of unique levels for the by
variable
cat_data(pmt_first, cols = c(SEX = "SEXf", RF = "RFf"), by = "STUDYf")
#> # A tibble: 6 × 6
#> name level `12-DEMO-001` `12-DEMO-002` `11-DEMO-005` `13-DEMO-001`
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 SEX male 10 (33.3) 18 (36.0) 29 (72.5) 23 (57.5)
#> 2 SEX female 20 (66.7) 32 (64.0) 11 (27.5) 17 (42.5)
#> 3 RF normal 30 (100.0) 50 (100.0) 10 (25.0) 40 (100.0)
#> 4 RF mild 0 (0.0) 0 (0.0) 10 (25.0) 0 (0.0)
#> 5 RF moderate 0 (0.0) 0 (0.0) 10 (25.0) 0 (0.0)
#> 6 RF severe 0 (0.0) 0 (0.0) 10 (25.0) 0 (0.0)