Finance with R

Introduction to the R package of this repository

Finance with R

This repository contains tutorials which showcase various Quantitative Finance tasks and applications with R online! It seems that as of 2018 everyone is using Python for Finance, but R definitely has some advantages. In addition to the tutorials as well as screencast videos there is a R Package financeR available at https://github.com/smartbeta/learnR/ which provides easy access to all codes that are discussed within the tutorials. Thus the package can be used to conveniently inspect and modify the respective tutorial content locally.

Finance with R package

Install the package

To install the package financeR please issue the following commands on the R console:

# install package `devtools` if not done yet
if(!("devtools" %in% rownames(installed.packages()))) { install.packages("devtools") }

# install package `financeR`
devtools::install_github("smartbeta/learnR/financeR")

# always load the package before using it
library(financeR)

# install futher required data and packages from GitHub and R-Forge, etc.
financeR::setup()

Use the package

The main function of financeR is tutorial(id) which opens the code of the respective tutorial with the identification code id, i.e.

# always load the package before using it
library(financeR)

# always explicitly use all functions of the package using the financeR:: notation
file.edit(financeR::tutorial(1)) # open tutorial #1

You can find the specific tutorial number at the top of each tutorial. Click here to browse through the list of tutorials.

Update tutorial information

If you have problems loading a tutorial it might be that your tutorial information is out of date. In this case just issue the update() function to receive the latest version without having to upgrade the package.

# always load the package before using it
library(financeR)

# always explicitly use all functions of the package using the financeR:: notation
financeR::update()