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)A data.frame with additional class "compact_summary".
A data.frame.
If TRUE, a Type column is added when the
object is rendered as a flextable.
If TRUE, a NA column showing the count of
missing values per column is added when rendered as a
flextable.
Maximum number of levels or unique values
displayed for factor and character columns. Additional
values are replaced by ", ...".
as_flextable.compact_summary()
Other as_flextable methods:
as_flextable(),
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)
Run the code above in your browser using DataLab