deb_decimal {debkeepr} | R Documentation |
A decimalized class for tripartite and tetrapartite values
Description
Create a vector of class deb_decimal
to integrate non-decimal currencies
and other measurements that use tripartite or tetrapartite units into
standardized forms of analysis provided by R.
Usage
deb_decimal(x = double(), unit = c("l", "s", "d", "f"), bases = c(20, 12))
Arguments
x |
A numeric vector representing the decimalized values of either tripartite or tetrapartite values. |
unit |
A character vector of length one indicating the unit for the
decimalized values, either |
bases |
Numeric vector of length 2 or 3 used to specify the bases for
the solidus or s, denarius or d, and optionally the farthing or f units.
Default is |
Details
The deb_decimal
class and the debkeepr
package use the nomenclature of
l, s, and d to represent the tripartite
system of 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 ingrained in much of Europe.
However, a variety of accounting systems arose at different times that used
other bases for the
solidus and denarius units and even additional units. The deb_decimal
class decimalizes either tripartite or tetrapartite values. The bases
attribute makes it possible to specify the bases for the solidus,
denarius, and optionally farthing units. The unit
attribute identifies
the decimalized unit: either libra, solidus, denarius, or farthing.
deb_decimal
vectors can either be tripartite, like deb_lsd
, or
tetrapartite, like deb_tetra
. These two kinds of deb_decimal
vectors
are distinguished by the length of bases
attribute (2 for tripartite and
3 for tetrapartite) and the addition of the farthing unit for tetrapartite.
If the solidus and denarius bases are equal, tripartite and tetrapartite
deb_decimal
vectors can be combined. The result is a deb_decimal
vector
with tripartite bases.
Value
Returns a vector of class deb_decimal
.
See Also
The deb_decimal
class works in concert with the deb_lsd
and deb_tetra
classes. These classes maintain the tripartite (deb_lsd
) and tetrapartite
(deb_tetra
) unit structure of non-decimal currencies and values.
See deb_lsd()
and deb_tetra()
.
Examples
# deb_decimal with tripartite units
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")
# Set the bases of the deb_decimal vector
deb_decimal(c(5.25, 3.825, 8.5), bases = c(60, 16))
# Create a prototype or vector of length 0
deb_decimal()
# To create a tetrapartite value, provide numeric vector
# of length 3 to bases argument
deb_decimal(c(5.11875, 3.234375, 8.2875),
bases = c(20, 12, 4))
deb_decimal(c(4914, 3105, 7956),
unit = "f",
bases = c(20, 12, 4))