Create a vector of class deb_decimal to integrate non-decimal currencies into standardized forms of analysis provided by R.

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.

Value

Returns a vector of class deb_decimal.

Details

The deb_decimal class and the debkeepr package use the nomenclature of l, s, and d to represent pounds, shillings, and pence units. The abbreviations derive from the Latin terms libra, solidus, and denarius. In the 8th century a solidus came to represent 12 denarii coins, and, for a time at least, 240 denarii were made from one libra or pound of silver. The custom of counting coins in dozens (solidi) and scores of dozens (librae) spread throughout the Carolingian Empire and became engrained in much of Europe. However, a variety of accounting systems arose at different times that used other bases for the solidus and denarius units. The bases attribute of deb_decimal vectors makes it possible to specify alternative bases for the solidus and denarius units, while the unit attribute identifies the decimalized unit: either libra, solidus, or denarius.

See also

The deb_decimal class works in concert with the deb_lsd class, which maintains the tripartite unit structure of most non-decimal currencies. See deb_lsd().

Examples

deb_decimal(c(5.25, 3.825, 8.5))
#> <deb_decimal[3]> #> [1] 5.250 3.825 8.500 #> # Unit: libra #> # Bases: 20s 12d
# Set the unit of the deb_decimal vector deb_decimal(c(105, 76.5, 170), unit = "s")
#> <deb_decimal[3]> #> [1] 105.0 76.5 170.0 #> # Unit: solidus #> # Bases: 20s 12d
deb_decimal(c(1260, 918, 240), unit = "d")
#> <deb_decimal[3]> #> [1] 1260 918 240 #> # Unit: denarius #> # Bases: 20s 12d
# Set the bases of the deb_decimal vector deb_decimal(c(5.25, 3.825, 8.5), bases = c(60, 16))
#> <deb_decimal[3]> #> [1] 5.250 3.825 8.500 #> # Unit: libra #> # Bases: 60s 16d
# Create a prototype or vector of length 0 deb_decimal()
#> <deb_decimal[0]> #> # Unit: libra #> # Bases: 20s 12d