deb_decimal: A decimalized class for pounds, shillings, and pence values

Description Usage Arguments Examples

View source: R/01.1-decimal-class.R

Description

User-facing function to create deb_decimal vector.

Usage

1
deb_decimal(x = double(), unit = c("l", "s", "d"), bases = c(20, 12))

Arguments

x

A numeric vector representing the decimalized values of a non-decimal currency.

unit

A character vector of length one indicating the unit for the decimalized values, either "l" (libra, the default), "s" (solidus), or "d" (denarius).

bases

Numeric vector of length 2 used to specify the bases for the solidus or s and denarius or d units. Default is c(20, 12), which conforms to the most widely used system of 1 pound = 20 shillings and 1 shilling = 12 pence.

Examples

1
2
3
4
5
deb_decimal(c(5.25, 3.825, 8.5))

# Set the unit of the deb_decimal vector
deb_decimal(c(105, 76.5, 170), unit = "s")
deb_decimal(c(1260, 918, 240), unit = "d")

jessesadler/debvctrs documentation built on June 14, 2021, 6:36 a.m.