Skip to contents

iv_format() is an S3 generic intended as a developer tool for making a custom class print nicely when stored in an iv. The default method simply calls format(), and in many cases this is enough for most classes. However, if your class automatically adds justification or padding when formatting a single vector, you might need to implement an iv_format() method to avoid that padding, since it often looks strange when nested in an interval vector.

Usage

iv_format(x)

Arguments

x

[vector]

A vector to format. This will be called on the iv_start() and iv_end() vectors of an iv.

Value

A character vector, likely generated through a call to format().

Examples

# Numeric values get padding automatically through `format()`
x <- c(1, 100)
format(x)
#> [1] "  1" "100"

# This ends up looking strange in an iv, so an `iv_format()` method for
# numeric values is implemented which turns off that padding
iv_format(x)
#> [1] "1"   "100"