cast-decimal {debkeepr} | R Documentation |
Cast to deb_decimal
Description
Cast x
to a deb_decimal
vector.
Usage
deb_as_decimal(x, ...)
## Default S3 method:
deb_as_decimal(x, ...)
## S3 method for class 'deb_decimal'
deb_as_decimal(x, ...)
## S3 method for class 'deb_lsd'
deb_as_decimal(x, unit = c("l", "s", "d"), ...)
## S3 method for class 'deb_tetra'
deb_as_decimal(x, unit = c("l", "s", "d", "f"), ...)
## S3 method for class 'numeric'
deb_as_decimal(x, unit = c("l", "s", "d", "f"), bases = c(20, 12), ...)
## S3 method for class 'logical'
deb_as_decimal(x, unit = c("l", "s", "d", "f"), bases = c(20, 12), ...)
## S3 method for class 'list'
deb_as_decimal(x, unit = c("l", "s", "d", "f"), bases = c(20, 12), ...)
Arguments
x |
An object to coerce to |
... |
Arguments passed on to further methods. |
unit |
A character vector of length one indicating the unit for the
decimalized values, either |
bases |
Numeric vector of length 2 used to specify the bases for the
solidus or s and denarius or d units. Default is |
Details
Like deb_as_lsd()
, deb_as_decimal()
provides a method to
cast a list of numeric vectors of length 3 to deb_decimal
. This may be
helpful because the data is input by the value instead of by the unit.
Value
A deb_decimal
vector.
See Also
deb_as_lsd()
and deb_as_tetra()
Examples
# Cast a deb_lsd vector to deb_decimal
x <- deb_lsd(l = c(5, 3, 7),
s = c(16, 5, 6),
d = c(6, 0, 8))
deb_as_decimal(x)
# Bases are automatically applied when
# casting from deb_lsd to deb_decimal
x2 <- deb_lsd(l = c(5, 3, 7),
s = c(16, 5, 6),
d = c(6, 0, 8),
bases = c(60, 16))
deb_as_decimal(x2)
# Cast a deb_tetra vector to deb_decimal
# Bases are automatically applied, creating
# a deb_decimal vector with three bases units.
y <- deb_tetra(l = c(5, 13, 7),
s = c(12, 8, 16),
d = c(3, 11, 0),
f = c(1, 3, 2))
deb_as_decimal(y)
# Cast a numeric vector to deb_decimal
z <- c(5.825, 3.25, 22/3)
deb_as_decimal(z)
# Use the unit and bases arguments to specify
# the unit and apply non-default bases
deb_as_decimal(z, unit = "s", bases = c(60, 16))
# Casting a list to deb_decimal provides an
# alternative to get lsd values to deb_decimal.
lsd_list <- list(c(5, 12, 3),
c(13, 8, 11),
c(7, 16, 0))
deb_as_decimal(lsd_list)
[Package debkeepr version 0.1.1 Index]