# Introduction to R for Finance

Learn essential data structures such as lists and data frames and apply that knowledge directly to financial examples.

Start Course for Free4 Hours14 Videos62 Exercises66,494 Learners5300 XPFinance Fundamentals TrackQuantitative Analyst Track

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.## Loved by learners at thousands of companies

## Course Description

In this finance-oriented introduction to R, you will learn essential data structures such as lists and data frames and have the chance to apply that knowledge to real-world financial examples. By the end of the course, you will be comfortable with the basics of manipulating your data to perform financial analysis in R.

- 1
### The Basics

**Free**Get comfortable with the very basics of R and learn how to use it as a calculator. Also, create your first variables in R and explore some of the base data types such as numerics and characters.

Welcome to Introduction to R for Finance!50 xpYour first R script100 xpArithmetic in R (1)100 xpArithmetic in R (2)50 xpAssignment and variables (1)100 xpAssignment and variables (2)100 xpFinancial returns50 xpFinancial returns (1)100 xpFinancial returns (2)100 xpBasic data types50 xpData type exploration100 xpWhat's that data type?50 xp - 2
### Vectors and Matrices

In this chapter, you will learn all about vectors and matrices using historical stock prices for companies like Apple and IBM. You will then be able to feel confident creating, naming, manipulating, and selecting from vectors and matrices.

What is a vector?50 xpc()ombine100 xpCoerce it50 xpVector names()100 xpVisualize your vector100 xpVector manipulation50 xpWeighted average (1)100 xpWeighted average (2)100 xpWeighted average (3)100 xpVector subsetting100 xpMatrix - a 2D vector50 xpCreate a matrix!100 xpMatrix <- bind vectors100 xpVisualize your matrix100 xpcor()relation100 xpMatrix subsetting100 xp - 3
### Data Frames

Arguably the most important data structure in R, the data frame is what most of your data will take the form of. It combines the structure of a matrix with the flexibility of having different types of data in each column.

What is a data frame?50 xpCreate your first data.frame()100 xpWhat goes in a data frame?50 xpMaking head()s and tail()s of your data with some str()ucture100 xpNaming your columns / rows100 xpData frame manipulation50 xpAccessing and subsetting data frames (1)100 xpAccessing and subsetting data frames (2)100 xpAccessing and subsetting data frames (3)100 xpAdding new columns100 xpPresent value50 xpPresent value of projected cash flows (1)100 xpPresent value of projected cash flows (2)100 xp - 4
### Factors

Questions with answers that fall into a limited number of categories can be classified as factors. In this chapter, you will use bond credit ratings to learn all about creating, ordering, and subsetting factors.

- 5
### Lists

Wouldn't it be nice if there was a way to hold related vectors, matrices, or data frames together in R? In this final chapter, you will explore lists and many of their interesting features by building a small portfolio of stocks.

Collaborators

#### Lore Dirick

Director of Data Science Education at Flatiron School

Lore is a data scientist with expertise in applied finance. She obtained her PhD in Business Economics and Statistics at KU Leuven, Belgium. During her PhD, she collaborated with several banks working on advanced methods for the analysis of credit risk data. Lore formerly worked as a Data Science Curriculum Lead at DataCamp, and is and is now Director of Data Science Education at Flatiron School, a coding school with branches in 8 cities and online programs.

## What do other learners have to say?

## Join over 10 million learners and start Introduction to R for Finance today!

## Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.