str_round: Round a number to desired number of shown digits

View source: R/strings.R

str_roundR Documentation

Round a number to desired number of shown digits

Description

Round a number to desired number of shown digits

Usage

str_round(x, digits = 2, less_than = NULL, more_than = NULL, pad = F)

Arguments

x

A vector of values

digits

How many digits to print

less_than

A value to add less than sign for

more_than

A value to add greater than sign for

pad

Whether to pad whitespace to force equal length strings

Value

A character vector

Examples

str_round(1.123, 2)
str_round(1.100, 2)
str_round(1.1000000, 2)
str_round(1.1000000, 3)
str_round(0.0000001, 3)
str_round(seq(0, 7, by = 1), 2, less_than = 2, more_than = 5)

Deleetdk/kirkegaard documentation built on May 2, 2024, 7:12 p.m.