iv_format {ivs}R Documentation

Formatting

Description

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)

# 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)

[Package ivs version 0.2.0 Index]