set_formatter_money: Set money formatter

View source: R/columns.R

set_formatter_moneyR Documentation

Set money formatter

Description

Set money formatter

Usage

set_formatter_money(
  widget,
  column,
  decimal = c(",", "."),
  thousand = c(".", ","),
  symbol = "$",
  symbol_after = "p",
  negative_sign = "-",
  precision = FALSE,
  hoz_align = "left"
)

Arguments

widget

A tabulator() HTML widget.

column

The name of the column the formatter is applied to.

decimal

(character): Symbol to represent the decimal point.

thousand

(character, bool): Symbol to represent the thousands separator. Set to FALSE to disable the separator.

symbol

(character): The currency symbol.

symbol_after

(bool): Whether to put the symbol after the number.

negative_sign

(character, bool): The sign to show in front of the number. Set to TRUE causes negative numbers to be enclosed in brackets (123.45), which is the standard style for negative numbers in accounting.

precision

(integer, bool): The number of decimals to display. Set to FALSE to display all decimals that are provided.

hoz_align

(character): The horizontal alignment of the column.

Value

The updated tabulator() HTML widget

Examples

data <- data.frame(
  Account_Number = c(
    123456,
    345667,
    234567,
    234566
  ),
  Account_Balance = c(100, -50, 200.30, -21.5)
)

tabulator(data) |>
  set_formatter_money(
    "Account_Balance",
    symbol = "\U20AC",
    symbol_after = FALSE,
    hoz_align = "right"
  )

rtabulator documentation built on Sept. 23, 2024, 5:11 p.m.