Learn R Programming

cheapr (version 1.1.0)

overview: An alternative to summary() inspired by the skimr package

Description

A cheaper summary() function, designed for larger data.

Usage

overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for default overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for logical overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for integer overview(x, digits = getOption("cheapr.digits", 2), hist = TRUE, ...)

# S3 method for numeric overview(x, digits = getOption("cheapr.digits", 2), hist = TRUE, ...)

# S3 method for integer64 overview(x, digits = getOption("cheapr.digits", 2), hist = TRUE, ...)

# S3 method for character overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for factor overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for Date overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for POSIXt overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for ts overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for zoo overview(x, digits = getOption("cheapr.digits", 2), ...)

# S3 method for data.frame overview(x, digits = getOption("cheapr.digits", 2), hist = TRUE, ...)

Value

An object of class "overview". Under the hood this is just a list of data frames. Key summary statistics are reported in each data frame.

Arguments

x

A vector or data frame.

digits

How many decimal places should the summary statistics be printed as? Default is 2.

...

Further arguments passed onto methods. Currently unused.

hist

Should in-line histograms be returned? Default is FALSE.

Details

No rounding of statistics is done except in printing which can be controlled either through the digits argument in overview(), or by setting the option options(cheapr.digits).
To access the underlying data, for example the numeric summary, just use $numeric, e.g. overview(rnorm(30))$numeric.

Examples

Run this code
library(cheapr)
overview(iris)

# With histograms
overview(airquality, hist = TRUE)

# Round to 0 decimal places
overview(airquality, digits = 0)

# We can set an option for all overviews
options(cheapr.digits = 1)
overview(rnorm(100))
options(cheapr.digits = 2) # The default

Run the code above in your browser using DataLab