Title: | Develop Actuarial Models |
Version: | 1.1.1 |
Description: | Actuarial reports are prepared for the last day of a specific period, such as a month, a quarter or a year. Actuarial models assume that certain events happen at the beginning or end of periods. The package contains functions to easily refer to the first or last (working) day within a specific period relative to a base date to facilitate actuarial reporting and to compare results. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0 |
Imports: | lubridate, dplyr, magrittr, crayon, purrr, tibble |
Suggests: | testthat, knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2020-04-13 08:28:33 UTC; admin |
Author: | Zuzanna Chmielewska
|
Maintainer: | Zuzanna Chmielewska <zchmielewska@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2020-04-13 08:40:02 UTC |
Change into a chosen type
Description
Change into a chosen type
Usage
as(x, type)
Arguments
x |
object to be coerced |
type |
type to be coerced into The "type" parameter takes one of the three values: "integer", "double" or "character". |
Value
the same objected with changed type
Examples
as(1:3, "character")
Create an interest rates curve
Description
Creates an object of class ircurve which represents in interest rates curve. The curve cosists of interest rates and is of type either "forward" or "spot". The interest rates curve can be for monthly or yearly periods.
Usage
as_ircurve(rates = double(), type = "forward", period = "year")
Arguments
rates |
vector of rates |
type |
"forward" or "spot" |
period |
"year" or "month" |
Value
Interest rates curve, an object of class ircurve.
Examples
as_ircurve(c(0.01, 0.015))
as_ircurve(c(0.002, 0.001), type = "spot", period = "month")
Change the period of an interest rates curve
Description
Changes the period of an interest rates curve (object of class ircurve) from year to monthl or vice versa.
Usage
change_period(ircurve, to)
Arguments
ircurve |
an object of class ircurve |
to |
"year" or "month" |
Value
An object of class ircurve with changed type.
Examples
my_ircurve <- as_ircurve(rep(0.01, 12), period = "month")
change_period(my_ircurve, to = "year")
Change the type of an interest rates curve
Description
Changes the type of an interest rates curve (object of class ircurve) from forward to spot or vice versa.
Usage
change_type(ircurve, to)
Arguments
ircurve |
an object of class ircurve |
to |
"forward" or "spot" |
Value
An object of class ircurve with changed type.
Examples
my_ircurve <- as_ircurve(c(0.1, 0.2, 0.3), type = "spot")
change_type(my_ircurve, to = "forward")
Coerce factors/POSIXct/Dates into characters
Description
Coerce factors/POSIXct/Dates into characters
Usage
coerce_to_character(tables)
Arguments
tables |
a list with two elements: x and y |
Value
a list with two elements: x and y
Compare two tables
Description
Returns the effect of comparison of the two tables. It gets common columns and number of rows of the two tables. In case of type mismatches, it coerces the weaker type into a stronger type. The output contains the absolute difference for numerical values and the_same/different for characters.
Usage
compare(x, y)
Arguments
x |
the first data frame |
y |
the second data frame |
Value
data frame
Examples
x <- data.frame(
a = rep(1, 3),
b = rep(2, 3)
)
y <- data.frame(
a = rep(2, 3),
b = rep(2, 3)
)
compare(x, y)
First day of a month
Description
Returns the first day of a month in reference to the base date.
Usage
dref_fdom(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_fdom("2020-09-21")
First day of a quarter
Description
Returns the first day of a quarter in reference to the base date.
Usage
dref_fdoq(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_fdoq("2020-09-21")
First day of an year
Description
Returns the first day of a year in reference to the base date.
Usage
dref_fdoy(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_fdoy("2020-09-21")
First working day of a month
Description
Returns the first working day of a month in reference to the base date.
Usage
dref_fwdom(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_fwdom("2020-11-21")
First working day of a quarter
Description
Returns the first working day of a quarter in reference to the base date.
Usage
dref_fwdoq(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_fwdoq("2020-09-21")
First working day of an year
Description
Returns the first working day of a year in reference to the base date.
Usage
dref_fwdoy(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_fwdoy("2022-09-21")
Last day of a month
Description
Returns the last day of a month in reference to the base date.
Usage
dref_ldom(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_ldom("2020-09-21")
Last day of a quarter
Description
Returns the last day of a month in reference to the base date.
Usage
dref_ldoq(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_ldoq("2020-09-21")
Last day of an year
Description
Returns the last day of a year in reference to the base date.
Usage
dref_ldoy(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_ldoy("2020-09-21")
Last working day of a month
Description
Returns the last working day of a month in reference to the base date.
Usage
dref_lwdom(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_lwdom("2020-10-21")
Last working day of a quarter
Description
Returns the last working day of a quarter in reference to the base date.
Usage
dref_lwdoq(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_lwdoq("2020-09-21")
Last working day of an year
Description
Returns the last working day of a year in reference to the base date.
Usage
dref_lwdoy(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_lwdoy("2022-09-21")
Month to date
Description
Returns the last day of the previous month.
Usage
dref_mtd(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_mtd("2020-09-21")
Quarter to date
Description
Returns the last day of the previous quarter.
Usage
dref_qtd(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_qtd("2020-09-21")
Year to date
Description
Returns the last day of the previous year.
Usage
dref_ytd(date)
Arguments
date |
base date in format YYYY-MM-DD |
Value
date
Examples
dref_ytd("2020-09-21")
Get common columns across two tables
Description
Get common columns across two tables
Usage
get_common_columns(tables)
Arguments
tables |
a list with two elements: x and y |
Value
a list with two elements: x and y
Get common number of rows across two tables
Description
Get common number of rows across two tables
Usage
get_common_nr_rows(tables)
Arguments
tables |
a list with two elements: x and y |
Value
a list with two elements: x and y
Get common types of columns across two tables
Description
Get common types of columns across two tables
Usage
get_common_types(tables)
Arguments
tables |
a list with two elements: x and y |
Value
a list with two elements: x and y
Print ircurve
Description
Print ircurve
Usage
## S3 method for class 'ircurve'
print(x, ...)
Arguments
x |
an object of class ircurve |
... |
further arguments passed to or from other methods |
Value
Prints the interest rates curve.
Examples
my_ircurve <- as_ircurve(c(0.022, 0.018))
print(my_ircurve)