FormatAsReal: Formats real numbers nicely.

View source: R/number.R

FormatAsRealR Documentation

Formats real numbers nicely.

Description

Formats real numbers nicely.

Usage

FormatAsReal(
  x,
  digits = 2,
  decimals = NULL,
  remove.leading.0 = FALSE,
  comma.for.thousands = TRUE,
  pad = FALSE
)

Arguments

x

The number(s)

digits

Number of significant digits.

decimals

Number of decimal places to show. If null, this is ignored.

remove.leading.0

Removes the initial 0 from numbers that are less than 1.

comma.for.thousands

If TRUE, uses a comma when there are thousands.

pad

If a vector is supplied and decimals is specified, adds spaces to the beginning of numbers so they become decimal aligned.

Details

Multiplies by 100, keeping digits or more significant digits and , and commas if in thousands or more. Based on formatC.


Displayr/flipFormat documentation built on Feb. 26, 2024, 12:37 a.m.