skim_format {skimr}R Documentation

Change the formatting options for printed skim objects

Description

Formats are dispatched according to the type of value returned by the "skimmer," i.e. summary function. One special formatting "type" exists for the names of the returned vector. The names are used to assign the levels for statistics that have more than one value. Counts and quantiles are common cases.

Usage

skim_format(..., .list = list(), append = TRUE, drop_new = FALSE)

skim_format_defaults()

show_formats(which = NULL)

Arguments

...

Named arguments that contain named lists specifying formats to apply.

.list

Instead of individual named entries, you can provided a list instead. If most ... arguments and .list is provided, values in .list take precedence.

append

Whether the provided options should be in addition to the defaults already in skim. Default is TRUE.

drop_new

Whether types outside of the defaults should be discarded.

which

A character vector. One or more of the classes whose formatting options you wish to display.

Details

When a vector is named, the name and the value are combined into a single formatted value. To deal with excessively long names for factor levels, only the first three characters of the name are returned by default. This can be changed by setting a new value for max_char within the .levels type.

Skim uses format() to convert the numeric values returned by the summary functions into displayed values. The default options are a subset of options available in that function.

Value

When setting formatting options, invisible(NULL). When looking up values, a list of option-value pairs.

Functions

Examples

# Format numbers to have more digits
skim_format(numeric = list(digits = 3))

# Show the values for the formats
show_formats()

# Show 4-character names in factor levels
skim_format(.levels = list(max_char = 4))

# Set multiple formats
skim_format(numeric = list(digits = 3), .levels = list(max_char = 4))

# Set multiple formats with a .list argument
my_formats <- list(numeric = list(digits = 3), .levels = list(max_char = 4))
skim_format(.list = my_formats)

# Alternatively, use rlang unquoting semantics
skim_format(!!!my_formats)

# Reset to the defaults
skim_format_defaults()

[Package skimr version 1.0.3 Index]