roundx_n: Round value based on magnitude

View source: R/roundx_n.R

roundx_nR Documentation

Round value based on magnitude

Description

Round value based on magnitude

Usage

roundx_n(x)

Arguments

x

A numeric value to be rounded. Values >= 100 are rounded to 1 decimal place. Values < 100 and >=1 are rounded to two decimal places. Values <1 are rounded to three decimal places.

Value

A numeric value rounded based on the magnitude of x

Examples

library(curios)
# Note: R will display right padded zero's below. This is a display manifestation only.
roundx_n(c(0.1234, 1.1234, 100.123))
# Verify rounding does not add right hand padding
roundx_n(c(0.1234, 1.1234, 100.123))[3]

johnaclouse/curios documentation built on June 14, 2022, 6:45 a.m.