View source: R/discrete_table.R
pt_cat_long | R Documentation |
Discrete data summary in long format
pt_cat_long(
data,
cols,
span = ".total",
all_name = " ",
all_name_span = "Summary",
summarize = c("both", "right", "top", "none"),
table = NULL,
by = NULL,
denom = c("group", "total")
)
data |
the data frame to summarize; the user should filter or subset
so that |
cols |
the columns to summarize; may be character vector or quosure |
span |
variable name for column spanner |
all_name |
a name to use for the complete data summary |
all_name_span |
table column name to use for data summaries across
levels of |
summarize |
where to include a data summary across subgroups;
use |
table |
a named list to use for renaming columns (see details and examples) |
by |
use |
denom |
the denominator to use when calculating percent for each level;
|
The data summary for all cells in the table is count (percent)
. The number
of data records in each column variable level is given under the column
title as n
.
When group
is selected for denom
, percent
is calculated with
denominator set to n
, the total for each column variable level. When
total
is selected for denom
, then percent
is calculated by the total
number of records in the input data.
The notes in this table are generated with pt_cat_long_notes()
.
An object with class pmtable
; see class-pmtable.
out <- pt_cat_long(pmt_first, cols = "SEXf,ASIANf", span = "FORMf")
## Not run:
st2report(stable(out))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.