mathematics {debkeepr}R Documentation

Math group with deb_lsd and deb_tetra vectors

Description

Math and Summary group of functions with deb_lsd and deb_tetra vectors. Implemented functions:

All other functions from the groups not currently implemented, including median(), quantile(), and summary().

Arguments

x

An vector of class deb_lsd or deb_tetra.

...

deb_lsd or deb_tetra vectors in sum() and arguments passed on to further methods in mean().

na.rm

Logical. Should missing values (including 'NaN“) be removed?

digits

Integer. Indicating the number of decimal places (round()) or significant digits (signif()) to be used.

Details

sum() and cumsum() return a normalized deb_lsd or deb_tetra values.

Round family of functions only affect the denarius (d) unit of a deb_lsd value and the farthing (f) unit of deb_tetra value. All values are normalized.

If you need a wider implementation of Math and Summary group functions, use a deb_decimal vector. However, median(), quantile(), and summary() are also not currently implemented for deb_decimal vectors. To use these functions cast deb_lsd, deb_tetra, and deb_decimal vectors to numeric.

Value

A deb_lsd or deb_tetra vector with normalized values.

Examples

x <- deb_lsd(l = c(5, 8, 12),
             s = c(16, 6, 13),
             d = c(6, 11, 0))
y <- deb_tetra(l = c(5, 8, 12),
               s = c(16, 6, 13),
               d = c(6, 11, 0),
               f = c(3, 2, 3))

# All values are normalized with sum and cumsum
sum(x)
sum(y)
cumsum(x)
cumsum(y)
mean(x)
mean(y)

# Round family on deb_lsd affects the denarius unit
x2 <- deb_lsd(5, 12, 5.8365)
y2 <- deb_tetra(5, 12, 8, 4.125)
round(x2)
round(y2)
round(x2, digits = 2)
signif(x2, digits = 2)
ceiling(x2)
ceiling(y2)
floor(x2)
floor(y2)
trunc(x2)
trunc(y2)

# The returned values are normalized whether
# they are positive or negative
x3 <- deb_lsd(9, 19, 11.825)
x4 <- deb_lsd(-9, -19, -11.825)
round(x3)
round(x3, digits = 1)

ceiling(x3)
floor(x4)

trunc(x3)
trunc(x4)


[Package debkeepr version 0.1.1 Index]