INTRODUCTION TO R
Lecturer: Fabien RONDEAU 2024
fabien.rondeau@univ-rennes1.fr
https://sites.google.com/site/rondeaufabien
Aims of the course:
This course is devoted to the introduction of R, a useful software for data analysis in
finance and in economics. Students have to be able to work with a data frame, to plot
multiple graphs, to calculate stylized facts, to estimate linear models (and to calculate
forecastings).
Assessments:
- Mid term
- Final exam
Recommended Readings:
[1] Hafner S., (2019), An introduction to R for beginners
[2] Paradis E., (2005), R for beginners,
Schedules:
Main objectives Chapters
Session 1 – 12 hours Install, work and manipulate data. 1-4
Monday – Tuesday
Session 2 – 12h Use time series data and plot. Linear 4-10
Wednesday – Thursday Regressions.
Session 3 – 6h R – macroeconomic application (1) Gapminder data
Friday
Session 4 – 6h R – macroeconomic application (2) OECD data
Saturday
1
Chapter 1: Introduction and preliminaries
1.1. R overview
1.2. Finding and installing R
1.3. Using R and getting started with the RStudio
Chapter 2: Operators, functions and data
2.1. Operators
2.2. Functions
2.3. Objects
2.4. Writing good code
2.5. File organization
Chapter 3: Data types and data objects
3.1. Data types
3.2. Overview of R data structures
3.3. Vectors
3.4. Matrices, arrays and lists
Chapter 4: Data frames, data import, and data export
4.1. Your working directory
4.2. Reading text files
4.3. Reading spreadsheet files
4.4. Creating data frames manually
4.5. Working with data frames
4.6. Writing data to files
Chapter 5: Graphics with R
5.1. Managing graphics
5.2. Graphical functions
5.3. Low-level plotting commands
5.4. A practical example
5.5. Lattice, ggplot2 and other packages
2
Chapter 6: Explanatory data analysis
6.1 Summary statistics
6.2 Counts and contingency tables
6.3 Histograms and other summary plots
6.4 Normal quintile and cumulative probability plots
Chapter 7: Basic data manipulation
7.1 Indexing and subsetting
7.2 Sorting data and location observations
7.3 Combining data frames and matrices
Chapter 8: Time series data
8.1 Plots, trends, and seasonal variation
8.2 Decomposition of series
8.3 Summary of commands and applications
Chapter 9: More on data manipulations: aggregating and summarizing data
9.1. Counts
9.2. Data aggregation and groups operations
9.3. The dplyr package and the magrittr operator
9.4. Reshaping data
Chapter 10: Linear regression
10.1. The lm function, model formulas, and statistical output
10.2. Linear regression