View source: R/discrete_table.R
pt_cat_wide | R Documentation |
Discrete data summary in long format
pt_cat_wide(
data,
cols,
by = ".total",
panel = by,
table = NULL,
all_name = "All data",
summarize = c("bottom", "none"),
complete = FALSE,
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 |
by |
a grouping variable for the summary; may be given as character vector or quosure. |
panel |
data set column name to stratify the summary |
table |
a named list to use for renaming columns (see details and examples) |
all_name |
a name to use for the complete data summary |
summarize |
where to put an all-data summary; choose |
complete |
logical; if |
denom |
the denominator to use when calculating percent for each level;
|
The data summary for this table is count (percent)
. The number of
data points for each row is also summarized as n
on the left hand side
of the table (either on the far left or just to the right of the by
column).
When group
is selected for denom
, percent
is calculated with
denominator set to n
, the total for each row. 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_wide_notes()
.
An object with class pmtable
; see class-pmtable.
out1 <- pt_cat_wide(pmt_first, cols = "SEXf,ASIANf")
stable(out1)
out2 <- pt_cat_wide(pmt_first, cols = "SEXf,ASIANf", by = "FORMf")
stable(out2)
## Not run:
st2report(stable(out1))
st2report(stable(out2))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.