Learn R Programming

pillar (version 1.6.0)

type_sum: Provide a succinct summary of an object

Description

type_sum() gives a brief summary of object type. Objects that commonly occur in a data frame should return a string with four or less characters. For most inputs, the argument is forwarded to vctrs::vec_ptype_abbr().

obj_sum() also includes the size of the object if vctrs::vec_is() is TRUE. It should always return a string (a character vector of length one).

size_sum() is called by obj_sum() to format the size of the object. It should always return a string (a character vector of length one), it can be an empty string "" to omit size information, this is what the default method does for scalars.

Usage

type_sum(x)

obj_sum(x)

size_sum(x)

Arguments

x

an object to summarise. Generally only methods of atomic vectors and variants have been implemented.

Details

When formatting a pillar, type_sum() will be called on a slice of the column vector. The formatted type should only depend on the type and not on the data, to avoid confusion.

Examples

Run this code
# NOT RUN {
obj_sum(1:10)
obj_sum(matrix(1:10))
obj_sum(Sys.Date())
obj_sum(Sys.time())
obj_sum(mean)

size_sum(1:10)
size_sum(trees)
size_sum(Titanic)
# }

Run the code above in your browser using DataLab