convert-bases {debkeepr}R Documentation

Convert bases of deb_lsd, deb_tetra, and deb_decimal vectors

Description

Convert bases of deb_lsd, deb_tetra, and deb_decimal vectors

Usage

deb_convert_bases(x, to)

## Default S3 method:
deb_convert_bases(x, to)

## S3 method for class 'deb_lsd'
deb_convert_bases(x, to)

## S3 method for class 'deb_decimal'
deb_convert_bases(x, to)

## S3 method for class 'deb_tetra'
deb_convert_bases(x, to)

Arguments

x

A vector of class deb_lsd, deb_tetra, or deb_decimal.

to

Numeric vector of length 2 or 3, representing the bases for the solidus, denarius, and optionally farthing units to be converted to.

Details

deb_convert_bases() is the only way to change the bases of the solidus, denarius, and farthing units associated with vectors of class deb_lsd, deb_tetra, and deb_decimal. It also provides a means to convert between tripartite and tetrapartite bases with deb_decimal vectors.

If x is a deb_decimal vector with tetrapartite bases and unit "f" and to is a numeric vector of length 2, the unit will be converted to "d".

Value

A vector of the same class as x with converted bases attribute.

Examples


lsd <- deb_lsd(5, 3, 8)
dec <- deb_decimal(8.825)
dec_tetra <- deb_decimal(1.840625, bases = c(20, 12, 4))
tetra <- deb_tetra(1, 16, 9, 3)

deb_convert_bases(lsd, to = c(60, 16))
deb_convert_bases(dec, to = c(60, 16))
deb_convert_bases(dec_tetra, c(60, 16, 8))
deb_convert_bases(tetra, to = c(60, 16, 8))

# Convert between tripartite and tetrapartite bases
deb_convert_bases(dec, to = c(60, 16, 8))
deb_convert_bases(dec_tetra, to = c(20, 12))


[Package debkeepr version 0.1.1 Index]