Create a vector of class deb_tetra
to integrate values with four units
into standardized forms of analysis provided by R.
Arguments
- l
Numeric vector representing the pounds unit.
- s
Numeric vector representing the shillings unit.
- d
Numeric vector representing the pence unit.
- f
Numeric vector representing the farthing or fourth unit.
- bases
Numeric vector of length 3 used to specify the bases for the solidus or s, denarius or d, and farthing or f units. Default is
c(20, 12, 4)
, which conforms to the English system of 1 pound = 20 shillings, 1 shilling = 12 pence, and 1 pence = 4 farthing.
Details
The deb_tetra
class extends the concept of the deb_lsd
class to
incorporate currencies and other types of values that consist of four units.
A variety of currencies and measurements of weights expanded beyond the
conventional tripartite system of pounds, shillings, and pence to include a
fourth unit. deb_tetra
adds a fourth unit, named f
for farthing, to the
l, s, and d units used by deb_lsd
.
The bases
attribute of deb_tetra
vectors makes it possible to specify
alternative bases for the solidus, denarius, and farthing units.
The length of l
, s
, d
, and f
must either be all equal, or a vector of
length 1 can be recycled to the length of the other argument(s). See
the vctrs package
for further details on recycling vectors. In addition, l
, s
, d
, and f
must either all have no values, resulting in a vector of length 0, or all
possess numeric vectors.
See also
The deb_tetra
class works in concert with the deb_decimal
class,
which can represent tetrapartite values as decimalized values. See
deb_decimal()
. To represent values with tripartite units see
deb_lsd()
.
Examples
deb_tetra(5, 3, 8, 2)
#> <deb_tetra[1]>
#> [1] 5:3s:8d:2f
#> # Bases: 20s 12d 4f
deb_tetra(l = c(10, 8, 5),
s = c(6, 13, 8),
d = c(8, 4, 10),
f = c(2, 3, 1))
#> <deb_tetra[3]>
#> [1] 10:6s:8d:2f 8:13s:4d:3f 5:8s:10d:1f
#> # Bases: 20s 12d 4f
# Recycle length 1 vector
deb_tetra(l = c(10, 8, 5),
s = c(6, 13, 8),
d = c(8, 4, 10),
f = 2)
#> <deb_tetra[3]>
#> [1] 10:6s:8d:2f 8:13s:4d:2f 5:8s:10d:2f
#> # Bases: 20s 12d 4f
# Set the bases of the deb_tetra vector
deb_tetra(5, 3, 8, 2, bases = c(60, 16, 8))
#> <deb_tetra[1]>
#> [1] 5:3s:8d:2f
#> # Bases: 60s 16d 8f
deb_tetra(l = c(10, 28, 5),
s = c(6, 33, 13),
d = c(8, 12, 10),
f = c(5, 3, 6),
bases = c(60, 16, 8))
#> <deb_tetra[3]>
#> [1] 10:6s:8d:5f 28:33s:12d:3f 5:13s:10d:6f
#> # Bases: 60s 16d 8f
# Create a prototype or vector of length 0
deb_tetra()
#> <deb_tetra[0]>
#> # Bases: 20s 12d 4f