Convert pounds, shillings, and pence to decimalized pounds.

deb_lsd_l(lsd, bases = c(20, 12))

Arguments

lsd

An lsd value. An object of class lsd or an object that can be coerced to class lsd: a numeric vector of length 3 or a list of such vectors.

bases

Numeric vector of length 2 used to specify the bases for the shillings or s and pence or d units. Default is c(20, 12), which conforms to the most widely used system of 1 pound = 20 shillings and 1 shilling = 12 pence. If lsd is of class lsd, the bases attribute will be used in the place of this argument.

Value

Returns a numeric vector of decimalized pounds.

Examples

# Create decimalized pounds deb_lsd_l(lsd = c(10, 5, 8))
#> [1] 10.28333
# With alternative bases for shillings and pence deb_lsd_l(lsd = c(10, 5, 8), bases = c(20, 16))
#> [1] 10.275
# Decimalization an object of class lsd will use the bases attribute lsd <- deb_as_lsd(lsd = c(10, 5, 8), bases = c(20, 16)) deb_lsd_l(lsd = lsd)
#> [1] 10.275
# The lsd values can be negative deb_lsd_l(lsd = c(-10, -5, -8))
#> [1] -10.28333
# The pounds, shillings, and pence do not need to be normalized deb_lsd_l(lsd = c(6, 25, 17))
#> [1] 7.320833
# Decimalize multiple lsd values with a list of lsd values lsd_list <- list(c(40, 5, 9), c(29, 7, 1), c(35, 6, 5)) deb_lsd_l(lsd = lsd_list)
#> [1] 40.28750 29.35417 35.32083
# Or an lsd object with alternative bases lsd_list2 <- deb_as_lsd(lsd = lsd_list, bases = c(20, 16)) deb_lsd_l(lsd = lsd_list2)
#> [1] 40.27813 29.35313 35.31562