Skip to contents

round_spec() creates a rounding specification object with default settings. The settings of a rounding specification object can be updated using functions in the round_ (see round_half_up, round_half_even, round_using_signif, round_using_decimal, and round_using_magnitude) and format_ (see format_missing, format_big, format_small, and format_decimal) families.

Usage

round_spec(force_default = FALSE)

Arguments

force_default

a logical value. If TRUE, then round_spec() ignores any stored default (see set_default_rounding_spec) and global options, returning factory default values. If FALSE, round_spec() first checks for a stored default, then falls back to periglue.* global options.

Value

an object of class rounding_specification.

Details

Rounding specifications are meant to be passed into the peri_glue and peri_value functions. A session-wide default specification can be stored with set_default_rounding_spec(), which round_spec() will use automatically when force_default = FALSE.

The round_spec() function intentionally uses no input arguments. This is to encourage users to develop rounding specifications using the round_ and format_ families in conjunction with the pipe (|>) operator.

Examples


rspec <- round_spec()

peri_value(x = pi, rspec)
#> [1] "3.1"