Learn R Programming

skimr (version 2.1.3)

print: Print skim objects

Description

skimr has custom print methods for all supported objects. Default printing methods for knitr/ rmarkdown documents is also provided.

Usage

# S3 method for skim_df
print(
  x,
  include_summary = TRUE,
  n = Inf,
  width = Inf,
  n_extra = NULL,
  strip_metadata = getOption("skimr_strip_metadata", FALSE),
  rule_width = base::options()$width,
  summary_rule_width = 40,
  ...
)

# S3 method for one_skim_df print( x, n = Inf, .width = Inf, n_extra = NULL, strip_metadata = getOption("skimr_strip_metadata", FALSE), .rule_width = base::options()$width, ... )

# S3 method for skim_list print( x, n = Inf, width = Inf, n_extra = NULL, .rule_width = base::options()$width, ... )

# S3 method for summary_skim_df print(x, .summary_rule_width = 40, ...)

Arguments

x

Object to format or print.

include_summary

Whether a summary of the data frame should be printed

n

Number of rows to show. If NULL, the default, will print all rows if less than option tibble.print_max. Otherwise, will print tibble.print_min rows.

width

Width of text output to generate. This defaults to NULL, which means use getOption("tibble.width") or (if also NULL) getOption("width"); the latter displays only the columns that fit on one screen. You can also set options(tibble.width = Inf) to override this default and always print all columns.

n_extra

Number of extra columns to print abbreviated information for, if the width is too small for the entire tibble. If NULL, the default, will print information about at most tibble.max_extra_cols extra columns.

strip_metadata

Whether tibble metadata should be removed.

rule_width

Width of the cli rules in printed skim object. Defaults to base::options()$width

summary_rule_width

Width of Data Summary cli rule, defaults to 40.

...

Other arguments passed on to individual methods.

.width

Width for the tibble for each type.

.rule_width

Width for the rule above the skim results for each type.

.summary_rule_width

the width for the main rule above the summary.

Methods (by class)

  • skim_df: Print a skimmed data frame (skim_df from skim()).

  • one_skim_df: Print an entry within a partitioned skim_df.

  • skim_list: Print a skim_list, a list of skim_df objects.

  • summary_skim_df: Print method for a summary_skim_df object.

Printing options

For better or for worse, skimr often produces more output than can fit in the standard R console. Fortunately, most modern environments like RStudio and Jupyter support more than 80 character outputs. Call options(width = 90) to get a better experience with skimr.

The print methods in skimr wrap those in the tibble package. You can control printing behavior using the same global options.

Behavior in <code>dplyr</code> pipelines

Printing a skim_df requires specific columns that might be dropped when using dplyr::select() or dplyr::summarize() on a skim_df. In those cases, this method falls back to tibble::print.tbl().

Controlling metadata behavior

On POSIX systems, skimr removes the tibble metadata when generating output. On some platforms, this can lead to all output getting removed. To disable that behavior, set either strip_metadata = FALSE when calling print or use options(skimr_strip_metadata = FALSE). The crayon package and the color support within tibble is also a factor. If your skimr results tables are empty you may need to run the following options(crayon.enabled = FALSE).

See Also

tibble::trunc_mat() For a list of global options for customizing print formatting. crayon::has_color() for the variety of issues that affect tibble's color support.