Calculate the interest of pounds, shillings, and pence given an interest rate and a duration. The function does not calculate compound interest.

deb_interest(lsd, interest, duration = 1, with_principal = TRUE, bases = c(20, 12), round = 5)

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. |
---|---|

interest | Interest rate in decimal form. A numeric vector of length 1. |

duration | Duration over which the interest is calculated, or the number of times that the interest should be added. A numeric vector of length 1. Default is 1. |

with_principal | Logical (default |

bases | Numeric vector of length 2 used to specify the bases for the
shillings or s and pence or d units. Default is |

round | Round pence unit to specified number of decimal places. Default is 5. Set to 0 to return pence as whole number. |

Returns an object of class lsd with a bases attribute.

# Calculate the interest with the principal over a certain duration # If £10.14.5 were lent over a period of 5 years at 6.25% deb_interest(lsd = c(10, 14, 5), interest = 0.0625, duration = 5)#> l s d #> [1] 14 1 5.0625# If £10.14.5 were lent over a period of 5 years at 8% deb_interest(lsd = c(10, 14, 5), interest = 0.08, duration = 5)#> l s d #> [1] 15 0 2.2# Or you can calculate only the interest deb_interest(lsd = c(10, 14, 5), interest = 0.0625, duration = 5, with_principal = FALSE)#> l s d #> [1] 3 7 0.0625# Interest for an lsd value with alternative bases deb_interest(lsd = c(10, 14, 5), interest = 0.0625, duration = 5, bases = c(20, 16))#> l s d #> [1] 14 1 4.5625# Interest of an object of class lsd will use the bases attribute lsd <- deb_as_lsd(lsd = c(10, 14, 5), bases = c(20, 16)) deb_interest(lsd = lsd, interest = 0.0625, duration = 5)#> l s d #> [1] 14 1 4.5625# Interest of a list of lsd values at a single rate lsd_list <- list(c(40, 5, 9), c(29, 7, 1), c(35, 6, 5)) deb_interest(lsd = lsd_list, interest = 0.08, duration = 5)#> l s d #> [1] 56 8 0.6 #> [2] 41 1 11.0 #> [3] 49 8 11.8# Or an lsd object with alternative bases lsd_list2 <- deb_as_lsd(lsd = lsd_list, bases = c(20, 16)) deb_interest(lsd = lsd_list2, interest = 0.08, duration = 5)#> l s d #> [1] 56 7 12.6 #> [2] 41 1 14.2 #> [3] 49 8 13.4