cat_data: Summarize categorical data

View source: R/discrete_table.R

cat_dataR Documentation

Summarize categorical data

Description

Summarize categorical data

Usage

cat_data(
  data,
  cols,
  by = ".total",
  panel = by,
  summarize_all = TRUE,
  all_name = "All",
  wide = FALSE,
  nby = NULL,
  complete = FALSE,
  denom = c("group", "total")
)

Arguments

data

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

cols

the columns to summarize; may be character vector or quosure

by

a grouping variable; may be character vector or quosure

panel

data set column name to stratify the summary

summarize_all

logical indicating whether or not to include a summary of the full data in the output.

all_name

label for full data summary.

wide

logical; if TRUE, data frame will be returned in wide format; if FALSE, it will be returned in long format.

nby

number of unique levels for the by variable.

complete

logical; if TRUE, then data the summary will be completed for missing levels of byand panel.

denom

the denominator to use when calculating percent for each level; group uses the total number in the chunk being summarized; total uses the total number in the data set; historically, group has been used as the default.

Examples


cat_data(pmt_first, cols = c(SEX = "SEXf", RF = "RFf"), by = "STUDYf")


metrumresearchgroup/pmtables documentation built on Oct. 27, 2024, 5:16 p.m.