Learn R Programming

businessPlanR (version 0.1-0)

nice_numbers: Format numbers in nice layout

Description

Uses format with some customized defaults. It's being called by kable_bpR.

Usage

nice_numbers(
  x,
  prefix,
  suffix,
  digits = 0L,
  width = NULL,
  nsmall = digits,
  space = c(html = " ", latex = "\\,")
)

Value

A formatted character string.

Arguments

x

The numeric value to format. Can be a single number, numeric vector, matrix, or data frame.

prefix

An optional symbol to prepend, ignored if missing.

suffix

An optional symbol to append, ignored if missing.

digits

See round.

width

See format.

nsmall

See format.

space

Named character vector, a space definition to put between prefix/suffix and value. Defaults to a thin space for both, LaTeX and HTML. If you use provide one character, that one is used regardless of the output environment.

Examples

Run this code
nice_numbers(12345.6789, suffix="€", digits=2)

Run the code above in your browser using DataLab