# Intermediate R for Finance Training Course

## Course Code

intermediaterforfinance

## Duration

21 hours (usually 3 days including breaks)

## Requirements

• Experience in basics of R programming
• A basic understanding of finance concepts

## Overview

R is a popular programming language in the financial industry. It is used in financial applications ranging from core trading programs to risk management systems.

In this instructor-led, live training, participants will learn advanced programming concepts in R as they walk through coding in R using financial examples.

By the end of this training, participants will be able to:

• Implement advanced R programming techniques
• Use R to manipulate their data to perform more advanced financial operations

Audience

• Programmers
• Finance professionals
• IT Professionals

Format of the course

• Part lecture, part discussion, exercises and heavy hands-on practice

## Course Outline

Introduction

Refresher on R Programming Basics

Creating Dates and Times in R

• Overview of Data Classes for Dates and Times
• Exploring Your First Date and Time Objects
• Creating Dates from Character Strings
• Using Vectors to Create Multiple Dates from Character Strings
• Specifying Date Formats
• Converting Between Date Formats
• Getting Time Intervals Between Dates
• Extracting Date Components Using Functions

Using If Statements and Operators in R

• Overview of the Exercise: Creating a Program for Buying or Selling Stocks
• Using Relational Operators
• Comparing Vectors Using Relational Operators
• Using Logical Operators
• Implementing And/Or
• Implementing Not
• Using Subsets with Data Frames and Logical Operators
• Hands On: Creating Your Stocks Program by Combining Relational and Logical Operators
• Using If Statements
• Exploring the Basic If Structure
• Implementing If-Else Statements
• Implementing Nested If Statements
• Using the ifelse() Function

Implementing Loops in R

• Implementing Repeat Loops Using Stock Prices Example
• Implementing Break Points
• Implementing While Loops Using Debt Example
• Using While Loops with Printing Function
• Creating Plots Using While Loops
• Using Break and If Statements in While Loops
• Implementing For Loops Using Stocks Example
• Looping Over Vectors
• Looping Over Data Frame Rows
• Looping Over Matrix Elements
• Using Break and Next

Implementing Functions in R

• Overview of Functions
• Getting Help with Functions and Reading Documentations
• Using Arguments and Optional Arguments
• Implementing Nested Functions
• Creating Your First Function: Turning Percentage into a Decimal
• Implementing Multiple Arguments in Your Custom Function
• Creating a Function to Calculate Present Value
• Understanding Function Scoping
• Introduction to Packages Using tidyquant

Using Apply Functions in R

• Using Apply Functions to Perform Complicated Calculations
• Implementing lapply() on a List
• Implementing lapply() on a Data Frame Using Sharpe Ratio Example
• Using FUN Arguments in lapply() to Improve the Sharpe Ratio Function
• Using sapply() to Simplify Apply
• Exercise: Examining a Sample Program on the Stock Market Crash List
• Using vapply() and FUN.VALUE
• Using Anonymous Functions

Troubleshooting

Summary & Conclusion

★★★★★
★★★★★