View source: R/compact_summary.R
| compact_summary | R Documentation |
Produces a compact summary of a data.frame. Each row of the result describes one column of the input with a type-specific synopsis.
Supported types and their summaries:
numeric / integer: count of non-NA values, min and max.
character: number of unique values, first values listed.
factor: number of levels, levels listed.
logical: count of non-NA values, counts of TRUE and
FALSE.
Date: count of non-NA values, date range.
POSIXct / POSIXlt: count of non-NA values, datetime
range.
hms / difftime: count of non-NA values, time range.
Character and factor columns share the same summary layout but report a different type label.
The result has class "compact_summary" and can be converted
into a flextable with as_flextable().
compact_summary(x, show_type = FALSE, show_na = FALSE, max_levels = 10L)
x |
A data.frame. |
show_type |
If |
show_na |
If |
max_levels |
Maximum number of levels or unique values
displayed for factor and character columns. Additional
values are replaced by |
A data.frame with additional class "compact_summary".
as_flextable.compact_summary()
Other as_flextable methods:
as_flextable.compact_summary(),
as_flextable.data.frame(),
as_flextable.gam(),
as_flextable.glm(),
as_flextable.grouped_data(),
as_flextable.htest(),
as_flextable.kmeans(),
as_flextable.lm(),
as_flextable.merMod(),
as_flextable.pam(),
as_flextable.summarizor(),
as_flextable.table(),
as_flextable.tabular(),
as_flextable.tabulator(),
as_flextable.xtable()
z <- compact_summary(iris)
as_flextable(z)
z <- compact_summary(iris, show_type = TRUE, show_na = TRUE)
as_flextable(z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.