Hydro-Climatic Modelling Workflow: A Practical Guide
  • Introduction
  • Software & Setup
  • Database
  • Model calibration
  • Bias correction
  • Validation
  • Climate scenarios

On this page

  • 1 Get the Data Used
  • 2 R (environment) & Rstudio (IDE)
    • 2.1 🧠 What is R?
    • 2.2 πŸ–₯️ What is RStudio?
    • 2.3 πŸ”§ How to use them together?
  • 3 Libraries (Packages)

Data, Software, Setup and Libraries (Packages)

1 Get the Data Used

The data used in this practical session are available in the project’s dedicated GitHub repository. The analysis is based on daily observed streamflow records and climate projection data for the LEZ watershed. Detailed metadata for this watershed are available on the HydroPortail website (here).

Download the Data

πŸ“₯ Download CSV

2 R (environment) & Rstudio (IDE)

Note

An IDE (Integrated Development Environment) is a software application that provides developers with a comprehensive set of tools for writing, testing, and debugging code in one place.

2.1 🧠 What is R?

R is a programming language and software environment designed primarily for statistical computing, data analysis, and visualization.

Benefits of learning R language
Figure 1: Some of the key advantages of learning the R programming language. (Source: C# Corner)

2.2 πŸ–₯️ What is RStudio?

RStudio is an IDE (Integrated Development Environment) specifically made for working with R. It provides a much more convenient and powerful interface than the basic R console:

  • πŸ“ Script editor with syntax highlighting and auto-completion
  • πŸ’» Console for interactive execution
  • πŸ“¦ Environment viewer to see your variables, functions, and data
  • πŸ“Š Plot viewer, πŸ—‚οΈ file browser, πŸ“– help pane, and more
  • βš™οΈ Easy access to package management, πŸ”„ version control, and πŸ“„ R Markdown / Quarto
Rstudio panes labeled
Figure 2: Overview of the four main panes in the RStudio interface. Source pane (top-left): where scripts and R Markdown files are written and edited. Console pane (bottom-left): where R commands are executed interactively. Environment pane (top-right): displays the current workspace, including variables and data. Output pane (bottom-right): shows plots, files, packages, help pages, and more. (Source: Posit)

2.3 πŸ”§ How to use them together?

1- Install R β†’ https://cran.r-project.org

2- Install RStudio β†’ https://posit.co/download/rstudio-desktop/

3- Then, open RStudio β†’ it will automatically use the installed R engine in the background.

R and Rstudio
Figure 3: R environment, the engine powering your data analysis, and RStudio, the dashboard and controls that make driving (coding) efficient and user-friendly. (Source: umanitoba.ca)

3 Libraries (Packages)

Below are the R packages used in this practical, with links and short descriptions. The simplest, general way to install any R package is:

install.packages("package_name") # install from CRAN
library(package_name)            # Load it after installation

If the package is on GitHub, we can use the remotes or devtools package:

# install remotes if not already installed
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")

# install a package from GitHub
remotes::install_github("username/repo_name")

# Load it
library(package_name)
The R packages used in this practical

πŸ“¦ {dplyr} β€” Grammar of data manipulation, providing a consistent set of verbs that solve the most common data manipulation challenge.

πŸ“¦ {tidyr} β€” Help you create tidy data.

πŸ“¦ {zoo} β€” Tools and functions for time series analysis and manipulation.

πŸ“¦ {trend} β€” Provides non-parametric tests test for trend detection.

πŸ“¦ `{lubridate} β€” To work with date-times and time-spans.

πŸ“¦ {extRemes} β€” For fitting and analyzing extreme value distributions.

πŸ“¦ {airGR} β€” GR hydrological models toolbox for rainfall–runoff modeling.

πŸ“¦ {hydromad} β€” Provide a modelling framework for environmental hydrology.

πŸ“¦ {EnvStats} β€” Graphical and statistical analyses of environmental data.

πŸ“¦ {MBC} β€” For calibrating and applying univariate and multivariate bias correction algorithms for climate model simulations of multiple climate variables.

Back to top

Β© Copyright 2025

  • Yves Tramblay

  • |
  • Serigne Bassirou Diop

Powered by Quarto