Go to main content
Logo HEC Montréal
Mathematics and Statistics Help Centre > Self learning tutorials > Mathematics Refresher Courses

Self-learning Tutorials

Data Visualization with R

Please note that the tutorials below are only available in French! 

Introduction

Introduction to the Data Visualization with R tutorials.

Read the Video Transcription

  


1. La fonction plot

  • The plot function
  • Plot type
  • Generic functions and regression
  • Customization: arguments, parameters
  • Adding elements: lines, points, text functions
  • Saving a rendered plot with the Graphical User Interface (GUI)
  • Saving a rendered plot with the console
  • Juxtaposition
  • Conclusion: the barplot, hist, boxplot and qqnorm functions, the stats library

Read the Video Transcription

  


2. Transformation des données avec la fonction reshape

  • The long format
  • The wide format
  • Casting a dataframe into the long format
  • The reshape function
  • Arguments of the reshape function
  • Conclusion: the reshape2 library

Read the Video Transcription

  


3a. ggplot2 : la fonction qplot

  • Preamble
  • Syntax
  • Remarks

Read the Video Transcription

  


3b. ggplot2 : la fonction ggplot

  • The ggplot function
  • Basic principles of the ggplot function: mapping, layers, aesthetics
  • Layer superposition: the geom_lines and geom_points functions
  • Exporting a graph: the ggsave function
  • Conclusion: combination of several visualizations

Read the Video Transcription

  


4. ggplot2 : les échelles de couleurs

  • Types of scales: color scales, position scales
  • The geom_* and scale_* functions
  • Predefined color scales: scale_color_* functions
  • Discrete color scales
  • Continuous color scales
  • User-defined color scales (manual)
  • Editing the legend
  • Conclusion: choice of colors, customization of legends

Read the Video Transcription

  


5. ggplot2 : les échelles de positions et les thèmes

  • Continuous position scales
  • Discrete position scales
  • Predefined themes
  • The theme_bw and theme functions
  • Conclusion: making sure graphs remain readable

Read the Video Transcription

Follow the MSHC on social media

Michel Keoula

Côte-Saint-Catherine Building
Room 2.760d

michel.keoula@hec.ca