Financial Functions & More

This fills the gaps credit analysts and loan modellers at Optimum Credit identify in the existing R code body. It allows for the production of documentation with less coding, replicates a number of Microsoft Excel functions useful for modelling loans (without rounding), and other helpful functions for producing charts and tables. It also has some additional scales for use, including a GBP scale.


README

optiRum is a growing package of utilities created by Optimum Credit Ltd's analysts. It is designed to provide convenience functions, standards, and useful snippets. Optimum Credit derives significant value from the R platform and associated community, so non-commercially sensitive functionality is made available in the spirit of reciprocity.

The lastest stable version (0.37.1) of the package is available on CRAN, and you can get the latest development version by running:

devtools::install_github("stephlocke/optiRum")

We have a range of financial functions that follow the Excel conventions. More of these will be released upon request (by emailing the package author) or as they are required by Optimum analysts

  • PV -- present value
  • PMT -- instalment
  • RATE -- interest rate
  • APR -- produces the annual compound rate needed for UK financial services

As we've been doing more on calculating income and expenditure, we have included some generic functions that help calculate values for the UK tax system

  • taxYear provides the year that a date would belong to. It can be overridden to use any tax year, but this provides a means for moving between changing tax values over time
  • calcNetIncome gives the ability to calculate UK net income figures based off personal circumstances and tax tables

There are functions for credit analysts and people dealing with logistic regressions:

  • the logit, odds and probability functions enable the conversion from logit to probability, vice versa and anywhere in between -- great for handling glm outputs
  • scaledScore -- this produces the scores that companies are used to working with for the assessment of credit quality
  • giniChart and giniCoef -- produces a Gini chart in keeping with the Optimum style and embeds the coefficient, whilst the standalone giniCoef function allows for extracting a value or a series of values for use

There are helper functions that reduce document development time:

  • sanitise -- handles special characters for LaTeX documents, including situations where you have unresolved square brackets at the beginning which is great if you've used cut2 and want to show summary stats for intervals
  • generatePDF -- allows the production of PDFs in a one-liner
  • multiplot -- allows the plotting of multiple charts into one area, primarily of benefit when producing figures for documents
  • pounds -- displays values with a UK pound symbol at the front with UK decimalisation practices, this extends scales
  • thousands -- displays values to the nearest thousand and in a condensed format that is ideal for charts, this extends scales
  • theme\_optimum -- this produces a good looking frame for charts
  • convertToXML -- a lot of people are concerned about getting data out of XML, but it's difficult to find functions that put output data in XML, so this function takes XML functionality and wraps it neatly for such cases
  • CJ.dt -- a cross-join function for two data.tables

News

Enhancement:

  • Made theme_optimum() backwards compatible

Maintenance:

  • Changes for ggplot2 2.0.0

Maintenance:

  • Changes for latest CRAN policies

New:

  • new function to calcIncomeTax for borrowers

Maintenance:

  • Changes for latest CRAN policies

New:

  • Added wordwrap formatter for splitting a string over multiple lines for chart axis

Enhancements:

  • Improved/overhauled theme_optimum()

Maintenance:

  • Improved package metadata and function's use of other packages

Enhancements:

  • Added fv argument to PV, RATE, and APR

Bug fixes:

  • Added space after \pounds in sanitise to allow for people putting £m etc

New:

  • Added function convertToXML for putting a data table into XML
  • Added function CJ.dt to cross-join two data.tables

Bug fixes:

  • Removed use of ~\ in generatePDF tests that was violating CRAN policies
  • Removed reference to AUC package in theme_optimum as it is not required

Bug fixes:

  • Removed use of tempdir() in generatePDF tests that was causing CRAN Windows compilation issues

Bug fixes:

  • Use of the data.table package was resulting in errors in generatePDF.
    Code has been amended to work under a new environment within the global package
  • The generatePDF function did not correctly pass ... to internal functions.
    This has now been changed, primarily for the benefit of being able to compile with xelatex etc

New:

  • thousands has been created to provide a neater format for scales and presentations
  • pounds has been created to provide a neater format for scales and presentations

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("optiRum")

0.37.3 by Stephanie Locke, a year ago


Report a bug at https://github.com/stephlocke/optiRum/issues


Browse source code at https://github.com/cran/optiRum


Authors: Stephanie Locke [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


Imports data.table, ggplot2, AUC, grid, knitr, plyr, scales, stringr, XML

Suggests testthat, covr


Suggested by iemisc.


See at CRAN