From 55041b2bc691bd1481109f84d9896ae2c2f5586f Mon Sep 17 00:00:00 2001
From: Ghislain Durif <gd.dev@libertymail.net>
Date: Thu, 5 Oct 2023 17:42:21 +0200
Subject: [PATCH] fix header level

---
 session_1/session_1.Rmd | 84 ++++++++++++++++++++---------------------
 session_2/session_2.Rmd | 38 +++++++++----------
 session_3/session_3.Rmd | 22 +++++------
 session_4/session_4.Rmd | 44 ++++++++++-----------
 session_5/session_5.Rmd | 26 ++++++-------
 session_6/session_6.Rmd | 38 +++++++++----------
 session_7/session_7.Rmd | 52 ++++++++++++-------------
 session_8/session_8.Rmd | 12 +++---
 8 files changed, 158 insertions(+), 158 deletions(-)

diff --git a/session_1/session_1.Rmd b/session_1/session_1.Rmd
index 4586fd4..301b3f1 100644
--- a/session_1/session_1.Rmd
+++ b/session_1/session_1.Rmd
@@ -15,7 +15,7 @@ knitr::opts_chunk$set(comment = NA)
 ```
 
 
-# Introduction
+## Introduction
 
 The goal of this practical is to familiarize yourself with R and the RStudio
 environment.
@@ -34,7 +34,7 @@ The objectives of this session will be to:
 ![](./img/intro_img.png){width=400px}
 </center>
 
-## Acknowledgments
+### Acknowledgments
 
 ![](./img/software_carpentry_logo.svg){width=300px}
 
@@ -44,7 +44,7 @@ The objectives of this session will be to:
 - [moderndive.com](https://moderndive.com)
 - [swcarpentry.github.io](http://swcarpentry.github.io/r-novice-gapminder/)
  
-## Some R background
+### Some R background
 
 ![](./img/Rlogo.png){width=40px}
 is a programming language and free software environment for statistical
@@ -80,7 +80,7 @@ bioconductor_packages <- nrow(biocPackages)
 - **`r bioconductor_packages`** available packages on http://www.bioconductor.org
 - **>500k** available repository using R on https://github.com/
 
-## How do I use R ?
+### How do I use R ?
 
 Unlike other statistical software programs like Excel, SPSS, or Minitab that provide [point-and-click](https://en.wikipedia.org/wiki/Point_and_click) interfaces, R is an [interpreted language](https://en.wikipedia.org/wiki/Interpreted_language).
 
@@ -92,7 +92,7 @@ R is usually used in a terminal in which you can type or paste your R code:
 
 But navigating between your terminal, your code and your plots can be tedious, this is why in `r format(Sys.time(), "%Y")` there is a better way to use R !
 
-## RStudio, the R Integrated development environment (*IDE*)
+### RStudio, the R Integrated development environment (*IDE*)
 
 An IDE application provides **comprehensive facilities** to computer programmers for
 software development. Rstudio is **free** and **open-source**.
@@ -101,11 +101,11 @@ To open RStudio, you can install the [RStudio application](https://www.rstudio.c
 
 Otherwise you can use the link and the login details provided to you by email. The web version of Rstudio is the same as the application expect that you can open it any recent browser.
 
-### Rstudio interface
+#### Rstudio interface
 
 ![](./img/RStudio.png)
 
-### A R console
+#### A R console
 
 The same console as before (in Red box)
 
@@ -113,7 +113,7 @@ The same console as before (in Red box)
 
 
 
-### A code editor
+#### A code editor
 
 We are now going to write our first commands.
 We could do it directly in the R console, with multi-line commands but this process is tedious.
@@ -126,7 +126,7 @@ Beside, you can keep your code history.
 ![](./img/RStudio_editor.png)
 
 
-## How to execute R code in Rstudio ?
+### How to execute R code in Rstudio ?
 
 RStudio offers you great flexibility in running code from within the editor window. There are buttons, menu choices, and keyboard shortcuts. To run the current line, you can
 
@@ -137,7 +137,7 @@ RStudio offers you great flexibility in running code from within the editor wind
 If you have modified a line of code within a block of code you have just run, there is no need to reselect the section and Run, you can use the next button along, Rerun the previous region. This will run the previous code block including the modifications you have made.
 
 
-# R as a Calculator
+## R as a Calculator
 
 Now that we know what we should do and what to expect, we are going to try some basic R instructions. A computer can perform all the operations that a calculator can do, so let's start with that:
 
@@ -158,7 +158,7 @@ To validate the line at the end of your command: press `Return`.
 </div>
 
 
-## First commands
+### First commands
 
 You should see a `>` character before a blinking cursor. The `>` is called a prompt. The prompt is shown when you can enter a new line of R code. 
 ```{r calculatorstep1, include=T, eval=F}
@@ -191,7 +191,7 @@ It is waiting for the next command. Write just `100` and press `⏎`:
 1 + 100
 ```
 
-## Errors, warnings, and messages
+### Errors, warnings, and messages
 
 The R console is a textual interface, which means that you will enter code, but it also means that R is going to write information back to you and that you will have to pay attention at what is written.
 
@@ -202,7 +202,7 @@ There are 3 categories of messages that R can send you: **Errors** prefaced with
 - **Message** are just friendly messages from R telling you how things are running.
 
 
-## R keeps to the mathematical order
+### R keeps to the mathematical order
 
 The order of operation is the natural mathematical order in R:
 
@@ -225,7 +225,7 @@ But to much parenthesis can be hard to read
 
 **Note :** The text following a `#` is a comment. It will not be interpreted by R. In the future, I advise you to use comments a lot to explain in your own words what the command means. 
 
-## Scientific notation
+### Scientific notation
 
 For small of large numbers, R will automatically switch to scientific notation.
 
@@ -240,7 +240,7 @@ You can use `e` to write your own scientific notation.
 5e3
 ```
 
-## Mathematical functions
+### Mathematical functions
 
 R is distributed with a large number of existing functions.
 To call mathematical function you must with `function_name(<number>)`.
@@ -271,7 +271,7 @@ or
 factorial(9)
 ```
 
-## Comparing things
+### Comparing things
 
 We have seen some examples that R can do all the things that a calculator can do.
 But when we are speaking of programming language, we are thinking of writing [computer programs](https://en.wikipedia.org/wiki/Computer_program).
@@ -323,7 +323,7 @@ computing and graphics (free & opensource) with a large library of external pack
   
 </div>
  
-# Variables and assignment
+## Variables and assignment
 
 In addition to being able to perform a huge number of computations very fast, computers can also store information to memory.
 This is a mandatory function to load your data and store intermediate states in your analysis.
@@ -346,7 +346,7 @@ We can then ask R to display the value of `x`.
 x
 ```
 
-## The environment
+### The environment
 
 You now see the `x` value in the environment box (*in red*).
 
@@ -398,7 +398,7 @@ You can type `is.` and press `tabulation`.
 Rstudio will show you a list of function whose names start with `is.`.
 This is called autocompletion, don't hesitate to spam your `tabulation` key as you write R code.
 
-## Variables names
+### Variables names
 
 Variable names can contain **letters**, **numbers**, **underscores** and **periods**.
 
@@ -439,7 +439,7 @@ celsius2kelvin
 </p>
 </details>
 
-## Functions are also variables
+### Functions are also variables
 
 ```{r VandAstep7, include=TRUE}
 logarithm <- log
@@ -487,7 +487,7 @@ Test that your `logarithm` function can work in base 10
 </details>
 
 
-## Writing function
+### Writing function
 
 We can  define our own function with :
 
@@ -545,13 +545,13 @@ minus <- function(a, b){
   return(result_1)
 }
 
-#R1:
+##R1:
 R1 <- minus(4,2)
 
-#R2
+##R2
 R2 <- minus(2,4)
 
-#R3
+##R3
 a <- 2
 b <- 10
 R3  <-  minus(b,a)
@@ -603,16 +603,16 @@ minus <- function(a, b){
   return(result_1)
 }
 
-#R1:
+##R1:
 R1 <- minus(a=6,b=3)
 
-#R2
+##R2
 R2 <- minus(b=3,a=6)
 
-#R3
+##R3
 R3 <- a
 
-#R4
+##R4
 R4  <- minus(b=b,a=a)
 ```
 </div>
@@ -704,7 +704,7 @@ print_hw()
 </details>
 
 
-## Some exercices
+### Some exercices
 
 <div class="pencadre">
 1. Try a function (`rect_area`) to calculate the area of a rectangle of length "L" and width "W"
@@ -792,7 +792,7 @@ even_print(3)
 </details>
 
 
-## Cleaning up
+### Cleaning up
 
 We can now clean your environment
 
@@ -842,12 +842,12 @@ ls()
   
 </div>
 
-# Complex variable type 
+## Complex variable type 
 
 You can only go so far with the variables we have already seen.
 In R there are also **complex variable type**, which can be seen as combination of simple variable type.
 
-## Vector (aka list)
+### Vector (aka list)
 
 Vectors are simple list of variable of the same type
 
@@ -906,7 +906,7 @@ y
 x == y
 ```
 
-## Accessing values
+### Accessing values
 
 There are multiple ways to access or replace values in vectors or other data structures. The most common approach is to use "indexing". 
 In the below, note that brackets `[ ]` are used for indexing, whereas you have already seen that parentheses `( )` are used to call a function and `{ }` to define function. It is very important not to mix these up.
@@ -962,7 +962,7 @@ x
 
 We will see other complex variables type during this formation.
 
-# Packages
+## Packages
 
 R base is like a new smartphone, you can do loots of things with it but you can also install new apps to a huge range of other things.
 In R those apps are called **packages**.
@@ -975,9 +975,9 @@ There are different sources to get packages from:
 
 To install packages from [Bioconducor](http://www.bioconductor.org) and [github](https://github.com/) you will need to install specific packages from the [CRAN](https://cran.r-project.org/).
 
-## Installing packages
+### Installing packages
 
-### From CRAN
+#### From CRAN
 
 To install packages, you can use the `install.packages` function (don't forget to use tabulation for long variable names).
 
@@ -1000,7 +1000,7 @@ install.packages("ggplot2")
 </p>
 </details>
 
-### From Bioconducor
+#### From Bioconducor
 
 To install packages from [bioconductor](http://www.bioconductor.org) you must first install a package called "BiocManager".
 This package imports a function called "install" allowing you to install packages hosted in bioconductor from their name.
@@ -1017,7 +1017,7 @@ Then to install, for example "tximport", you just have to write:
 BiocManager::install("tximport")
 ```
 
-### From github
+#### From github
 
 If you need to install a package that is not available on the CRAN but on a github repository, you can do it using the "remotes" package. Indeed this package imports functions that will allow you to install a package available on [github](https://github.com/) or bitbucket or gitlab directly on your computer.
 
@@ -1043,7 +1043,7 @@ remotes::install_github("thomasp85/gganimate@v1.0.7")
 
 You can find more information in the documentation of remotes : [https://remotes.r-lib.org](https://remotes.r-lib.org)
 
-## Loading packages
+### Loading packages
 
 Once a package is installed, you need to load it in your R session to be able to use it.
 The command `sessionInfo` display your session information.
@@ -1066,7 +1066,7 @@ sessionInfo()
 </p>
 </details>
 
-## Unloading packages
+### Unloading packages
 
 Sometime, you may want to unload package from your session instead of relaunching R.
 
@@ -1078,10 +1078,10 @@ unloadNamespace("ggplot2")
 sessionInfo()
 ```
 
-## Help on packages (when existing)
+### Help on packages (when existing)
 
 ```R
 browseVignettes("ggplot2")
 ```
 
-## See you in [Session 2 : "Introduction to Tidyverse"](https://can.gitbiopages.ens-lyon.fr/R_basis/session_2.html)
+### See you in [Session 2 : "Introduction to Tidyverse"](https://can.gitbiopages.ens-lyon.fr/R_basis/session_2.html)
diff --git a/session_2/session_2.Rmd b/session_2/session_2.Rmd
index 3957e32..93da489 100644
--- a/session_2/session_2.Rmd
+++ b/session_2/session_2.Rmd
@@ -108,7 +108,7 @@ read_csv("data-raw/vehicles.csv") %>%
   write_csv("mpg.csv")
 ```
 
-# Introduction
+## Introduction
 
 In the last session, we have gone through the basis of R.
 Instead of continuing to learn more about R programming, in this session we are going to jump directly to rendering plots.
@@ -127,7 +127,7 @@ The objectives of this session will be to:
 - Learn the different aesthetics in R plots
 - Compose complex graphics
 
-## Tidyverse
+### Tidyverse
 
 The `tidyverse` package is a collection of R packages designed for data science that include `ggplot2`.
 
@@ -148,7 +148,7 @@ Luckily for you, `tidyverse` is preinstalled on your Rstudio server. So you just
 library("tidyverse")
 ```
  
-## Toy data set `mpg`
+### Toy data set `mpg`
 
 This dataset contains a subset of the fuel economy data that the EPA makes available on [fueleconomy.gov](http://fueleconomy.gov).
 It contains only models which had a new release every year between 1999 and 2008.
@@ -197,13 +197,13 @@ new_mpg
 Here we can see that `new_mpg` is a `tibble` we will come back to `tibble` later.
 
 
-## New script
+### New script
 
 Like in the last session, instead of typing your commands directly in the console, you are going to write them in an R script.
 
 ![](./img/formationR_session2_scriptR.png)
 
-# First plot with `ggplot2`
+## First plot with `ggplot2`
 
 We are going to make the simplest plot possible to study the relationship between two variables: the scatterplot.
 
@@ -272,7 +272,7 @@ Dots with the same coordinates are superposed.
 
 </details>
  
-# Aesthetic mappings
+## Aesthetic mappings
 
 `ggplot2` will automatically assign a unique level of the aesthetic (here a unique color) to each unique value of the variable, a process known as scaling. `ggplot2` will also add a legend that explains which levels correspond to which values.
 
@@ -282,7 +282,7 @@ Try the following aesthetic:
 - `alpha`
 - `shape`
 
-## `color` mapping
+### `color` mapping
 
 ```{r new_mpg_plot_e, cache = TRUE, fig.width=8, fig.height=4.5}
 ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, color = class)) + 
@@ -290,21 +290,21 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, color = class)) +
 ```
 
 
-## `size` mapping
+### `size` mapping
 
 ```{r new_mpg_plot_f, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE}
 ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, size = class)) + 
   geom_point()
 ```
 
-## `alpha` mapping
+### `alpha` mapping
 
 ```{r new_mpg_plot_g, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE}
 ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, alpha = class)) + 
   geom_point()
 ```
 
-## `shape` mapping
+### `shape` mapping
 
 ```{r new_mpg_plot_h, cache = TRUE, fig.width=8, fig.height=4.5, warning=FALSE}
 ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, shape = class)) + 
@@ -341,7 +341,7 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy)) +
 </p>
 </details>
  
-## Mapping a **continuous** variable to a color.
+### Mapping a **continuous** variable to a color.
 
 You can also map continuous variable to a color
 
@@ -363,7 +363,7 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, color = displ < 5)) +
 </p>
 </details>
  
-# Facets
+## Facets
 
 You can create multiple plots at once by faceting. For this you can use the command `facet_wrap`.
 This command takes a formula as input.
@@ -394,7 +394,7 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy)) +
 </p>
 </details>
 
-# Composition
+## Composition
 
 There are different ways to represent the information :
 
@@ -440,9 +440,9 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy)) +
   geom_smooth(data = filter(mpg, class == "subcompact"))
 ```
 
-# Challenge  !
+## Challenge  !
 
-## First challenge
+### First challenge
 <div class="pencadre">
 Run this code in your head and predict what the output will look like. Then, run the code in R and check your predictions.
 </div>
@@ -470,7 +470,7 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, color = drive)) +
 
 
 
-## Second challenge
+### Second challenge
 
 <div class="pencadre">
 How being a `Two Seaters` car (*class column*) impact the engine size (*displ column*) versus fuel efficiency relationship (*hwy column*) ?
@@ -538,7 +538,7 @@ plot_color_a_class("Compact Cars")
 </details>
 
 
-## Third challenge
+### Third challenge
 
 <div class="pencadre">
 Recreate the R code necessary to generate the following graph (see "linetype" option of "geom_smooth")
@@ -562,9 +562,9 @@ ggplot(data = new_mpg, mapping = aes(x = displ, y = hwy, color = fuel)) +
 </p>
 </details>
 
-## See you in [R.3: Transformations with ggplot2](https://can.gitbiopages.ens-lyon.fr/R_basis/session_3.html)
+### See you in [R.3: Transformations with ggplot2](https://can.gitbiopages.ens-lyon.fr/R_basis/session_3.html)
 
-# To go further: publication ready plots
+## To go further: publication ready plots
 
 Once you have created the graph you need for your publication, you have to save it.
 You can do it with the `ggsave` function.
diff --git a/session_3/session_3.Rmd b/session_3/session_3.Rmd
index 8e07389..ba6b470 100644
--- a/session_3/session_3.Rmd
+++ b/session_3/session_3.Rmd
@@ -14,7 +14,7 @@ knitr::opts_chunk$set(echo = TRUE)
 knitr::opts_chunk$set(comment = NA)
 ```
 
-# Introduction
+## Introduction
 
 In the last session, we have seen how to use `ggplot2` and [The Grammar of Graphics](https://www.amazon.com/Grammar-Graphics-Statistics-Computing/dp/0387245448/ref=as_li_ss_tl). The goal of this practical is to practices more advanced features of `ggplot2`.
 
@@ -37,7 +37,7 @@ library("tidyverse")
 
 Like in the previous sessions, it's good practice to create a new **.R** file to write your code instead of using the R terminal directly.
  
-# `ggplot2` statistical transformations
+## `ggplot2` statistical transformations
 
 In the previous session, we have plotted the data as they are by using the variable values as **x** or **y** coordinates, color shade, size or transparency.
 When dealing with categorical variables, also called **factors**, it can be interesting to perform some simple statistical transformations.
@@ -57,7 +57,7 @@ We are going to use the `diamonds` data set included in `tidyverse`.
 str(diamonds)
 ```
 
-## Introduction to `geom_bar`
+### Introduction to `geom_bar`
 
 We saw scatterplot (`geom_point()`), smoothplot (`geom_smooth()`).
 Now barplot with `geom_bar()` : 
@@ -72,7 +72,7 @@ More diamonds are available with high quality cuts.
 On the x-axis, the chart displays **cut**, a variable from diamonds. On the y-axis, it displays **count**, **but count is not a variable in diamonds!**
 
 
-## **geom** and **stat**
+### **geom** and **stat**
 
 The algorithm used to calculate new values for a graph is called a **stat**, short for statistical transformation.
 The figure below describes how this process works with `geom_bar()`.
@@ -88,7 +88,7 @@ ggplot(data = diamonds, mapping = aes(x = cut)) +
 
 Every **geom** has a default **stat**; and every **stat** has a default **geom**. This means that you can typically use **geoms** without worrying about the underlying statistical transformation. There are three reasons you might need to use a **stat** explicitly:
 
-## Why **stat** ?
+### Why **stat** ?
 
 You might want to override the default stat.
 For example, in the following `demo` dataset we already have a variable for the **counts** per `cut`.
@@ -143,7 +143,7 @@ If group is not used, the proportion is calculated with respect to the data that
 </p>
 </details>
 
-## More details with `stat_summary`
+### More details with `stat_summary`
 
 <div class="pencadre">
 You might want to draw greater attention to the statistical transformation in your code. 
@@ -178,7 +178,7 @@ ggplot(data = diamonds, mapping = aes(x = cut, y = depth)) +
 </p>
 </details>
 
-# Coloring area plots
+## Coloring area plots
 
 <div class="pencadre">
 You can color a bar chart using either the `color` aesthetic, or, more usefully `fill`:
@@ -213,7 +213,7 @@ ggplot(data = diamonds, mapping = aes(x = cut, fill = clarity)) +
 </p>
 </details>
 
-# Position adjustments
+## Position adjustments
 
 The stacking of the `fill` parameter is performed by the position adjustment `position`
 
@@ -285,7 +285,7 @@ ggplot(data = diamonds, mapping = aes(x = cut, y = depth, color = clarity)) +
 </p>
 </details>
 
-# Coordinate systems
+## Coordinate systems
 
 Cartesian coordinate system where the x and y positions act independently to determine the location of each point. There are a number of other coordinate systems that are occasionally helpful.
 
@@ -333,9 +333,9 @@ ggplot(data = diamonds, mapping = aes(x = cut, fill = cut)) +
 
 By combining the right **geom**, **coordinates** and **faceting** functions, you can build a large number of different plots to present your results.
 
-# See you in [R.4: data transformation](https://can.gitbiopages.ens-lyon.fr/R_basis/session_4.html)
+## See you in [R.4: data transformation](https://can.gitbiopages.ens-lyon.fr/R_basis/session_4.html)
 
-# To go further:  animated plots from xls files
+## To go further:  animated plots from xls files
 
 In order to be able to read information from a xls file, we will use the `openxlsx` packages. To generate animation we will use the `ggannimate` package. The additional `gifski` package will allow R to save your animation in the gif format (Graphics Interchange Format)
 
diff --git a/session_4/session_4.Rmd b/session_4/session_4.Rmd
index d22517b..1f2210f 100644
--- a/session_4/session_4.Rmd
+++ b/session_4/session_4.Rmd
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(echo = TRUE)
 knitr::opts_chunk$set(comment = NA)
 ```
 
-# Introduction
+## Introduction
 
 The goal of this practical is to practice data transformation with `tidyverse`.
 The objectives of this session will be to:
@@ -47,7 +47,7 @@ library("nycflights13")
   </p>
 </details>
  
-## Data set : nycflights13
+### Data set : nycflights13
 
 `nycflights13::flights` Contains all 336,776 flights that departed from New York City in 2013.
 The data comes from the US Bureau of Transportation Statistics, and is documented in `?flights`
@@ -69,7 +69,7 @@ colnames(flights)
 ```
 
 
-## Data type
+### Data type
 
 In programming languages, all variables are not equal.
 When you display a `tibble` you can see the **type** of a column.
@@ -85,7 +85,7 @@ Here is a list of common variable **types** that you will encounter
 
 You cannot add an **int** to a **chr**, but you can add an **int** to a **dbl** the results will be a **dbl**.
  
-# `filter` rows
+## `filter` rows
 
 Variable **types** are important to keep in mind for comparisons.
 The `filter()` function allows you to subset observations based on their values.
@@ -97,7 +97,7 @@ The good reflex to take when you meet a new function of a package is to look at
 ```
 
 
-## Use test to filter on a column
+### Use test to filter on a column
 
 You can use the relational operators (`<`,`>`,`==`,`<=`,`>=`,`!=`) to make a test on a column and keep rows for which the results is `TRUE`.
 
@@ -130,7 +130,7 @@ long_flights <- filter(flights, air_time >= 680)
 </details>
 
 
-## Logical operators to filter on several columns
+### Logical operators to filter on several columns
 
 Multiple arguments to `filter()` are combined with **AND**: every expression must be `TRUE` in order for a row to be included in the output.
 
@@ -209,7 +209,7 @@ What happens when you put your variable assignment code between parenthesis `(`
 ```
 </div>
 
-## Missing values
+### Missing values
 
 One important feature of R that can make comparison tricky is missing values, or `NA`s for **Not Availables**.
 Indeed each of the variable type can contain either a value of this type (i.e., `2` for an **int**) or nothing.
@@ -240,7 +240,7 @@ filter(df, y > 1)
 filter(df, is.na(y) | y > 1)
 ```
 
-## Challenges
+### Challenges
 
 <div class="pencadre">
 Find all flights that:
@@ -285,7 +285,7 @@ NA * 0 # here we have a true computation
 </p>
 </details>
 
-# Arrange rows with `arrange()`
+## Arrange rows with `arrange()`
 
 `arrange()` works similarly to `filter()` except that instead of selecting rows, it changes their order.
 
@@ -301,7 +301,7 @@ arrange(flights, distance, desc(dep_delay))
 ```
 
 
-## Missing values
+### Missing values
 
 Missing values are always sorted at the end:
 
@@ -315,7 +315,7 @@ arrange(df, y)
 arrange(df, desc(y))
 ```
 
-## Challenges
+### Challenges
 <div class="pencadre">
 
 - Find the most delayed flight at arrival (`arr_delay`).
@@ -344,7 +344,7 @@ arrange(df, desc(is.na(y)))
 </details>
 
 
-# Select columns with `select()`
+## Select columns with `select()`
 
 `select()` allows you to rapidly zoom in on a useful subset using operations based on the names of the variables.
 
@@ -373,7 +373,7 @@ select(flights, Y = year, M = month, D = day)
 ```
 
 
-## Helper functions
+### Helper functions
 
 here are a number of helper functions you can use within `select()`:
 
@@ -385,7 +385,7 @@ here are a number of helper functions you can use within `select()`:
 
 See `?select` for more details.
 
-## Challenges
+### Challenges
 
 <div class="pencadre">
 <p>
@@ -478,7 +478,7 @@ select(flights, contains("TIME", ignore.case = FALSE))
  
  
  
-# Add new variables with `mutate()`
+## Add new variables with `mutate()`
 
 It’s often useful to add new columns that are functions of existing columns. That’s the job of `mutate()`.
 
@@ -509,7 +509,7 @@ Then let's create an even smaller dataset as toy dataset to test your commands b
 </details>
 
 
-## `mutate()`
+### `mutate()`
 
 
 ```R
@@ -639,7 +639,7 @@ mutate(
 </details>
 
 
-## Useful creation functions
+### Useful creation functions
 
 - Offsets: lead(x) and lag(x) allow you to refer to the previous or next values of the column x. This allows you to compute running differences (e.g. `x - lag(x)`) or find when values change (`x != lag(x)`).
 - R provides functions for running cumulative sums, products, mins and maxes: `cumsum()`, `cumprod()`, `cummin()`, `cummax()`; and dplyr provides `cummean()` for cumulative means. 
@@ -647,10 +647,10 @@ mutate(
 - Ranking: there are a number of ranking functions, the most frequently used being min_rank(). They differ by the way ties are treated, etc. Try ?mutate, ?min_rank, ?rank, for more information.
 
 
-## See you in [R#5: Pipping and grouping](https://can.gitbiopages.ens-lyon.fr/R_basis/session_5.html)
+### See you in [R#5: Pipping and grouping](https://can.gitbiopages.ens-lyon.fr/R_basis/session_5.html)
 
 
-# To go further:  Data transformation and color sets.
+## To go further:  Data transformation and color sets.
 
 There are a number of color palettes available in R, thanks to different packages such as `RColorBrewer`, `Viridis` or `Ghibli`. 
 We will use them here to decorate our graphs, either on data already studied in the training, `mpg`, or on more specialized data such as lists of differentially expressed genes ( [GSE86356](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE86356) )
@@ -667,7 +667,7 @@ library(ghibli)
 library(viridis)
 ```
 
-## RColorBrewer & Ghibli 
+### RColorBrewer & Ghibli 
 
 Using `mpg` and the 'ggplot2' package, reproduce the graph studied in session 2, 3.1: color mapping. 
 Modify the colors representing the class of cars with the palettes `Dark2` of [RColorBrewer](https://www.datanovia.com/en/fr/blog/palette-de-couleurs-rcolorbrewer-de-a-a-z/), then `MononokeMedium` from [Ghibli](https://github.com/ewenme/ghibli). 
@@ -703,7 +703,7 @@ To display only Brewer palettes that are colorblind friendly, specify the option
 display.brewer.all(colorblindFriendly = TRUE)
 ```
 
-## Viridis
+### Viridis
 
 `viridis` package provide a series of color maps that are designed to improve graph readability for readers with common forms of color blindness and/or color vision deficiency. 
 
@@ -788,7 +788,7 @@ DM1_tile_base + scale_fill_viridis_c()
   </p>
 </details>
 
-## Volcano Plot 
+### Volcano Plot 
 
 For this last exercise, we will use the results of the differential gene expression analysis between DM1 vs WT conditions. 
 
diff --git a/session_5/session_5.Rmd b/session_5/session_5.Rmd
index 33d98c5..0c5f6e4 100644
--- a/session_5/session_5.Rmd
+++ b/session_5/session_5.Rmd
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(echo = TRUE)
 knitr::opts_chunk$set(comment = NA)
 ```
 
-# Introduction
+## Introduction
 
 The goal of this practical is to practice combining data transformation with `tidyverse`.
 The objectives of this session will be to:
@@ -40,7 +40,7 @@ library("nycflights13")
 </p>
 </details>
 
-# Combining multiple operations with the pipe
+## Combining multiple operations with the pipe
 
 <div id="pencadre">
 Find the 10 most delayed flights using a ranking function. `min_rank()`
@@ -82,12 +82,12 @@ Working with the pipe is one of the key criteria for belonging to the `tidyverse
 
 The pipe is a powerful tool, but it’s not the only tool at your disposal, and it doesn’t solve every problem! Pipes are most useful for rewriting a fairly short linear sequence of operations. I think you should reach for another tool when:
 
-## When not to use the pipe
+### When not to use the pipe
 
 - Your pipes are longer than (say) ten steps. In that case, create intermediate functions with meaningful names. That will make debugging easier, because you can more easily check the intermediate results, and it makes it easier to understand your code, because the variable names can help communicate intent.
 - You have multiple inputs or outputs. If there isn’t one primary object being transformed, but two or more objects being combined together, don’t use the pipe. You can create a function that combines or split the results.
 
-# Grouping variable
+## Grouping variable
 
 The `summarise()` function collapses a data frame to a single row.
 Check the difference between `summarise()` and `mutate()` with the following commands:
@@ -101,7 +101,7 @@ flights %>%
 
 Where mutate compute the `mean` of `dep_delay` row by row (which is not useful), `summarise` compute the `mean` of the whole `dep_delay` column.
 
-## The power of `summarise()` with `group_by()`
+### The power of `summarise()` with `group_by()`
 
 The `group_by()` function changes the unit of analysis from the complete dataset to individual groups.
 Individual groups are defined by categorial variable or **factors**.
@@ -125,7 +125,7 @@ ggplot(data = flights_delay, mapping = aes(x = month, y = delay)) +
 Why did we `group_by` `year` and `month` and not only `year` ?
 </div>
 
-## Missing values
+### Missing values
 
 <div class="pencadre">
 You may have wondered about the `na.rm` argument we used above. What happens if we don’t set it?
@@ -142,7 +142,7 @@ flights %>%
 
 Aggregation functions obey the usual rule of missing values: **if there’s any missing value in the input, the output will be a missing value**.
 
-## Counts
+### Counts
 
 Whenever you do any aggregation, it’s always a good idea to include either a count (`n()`). That way you can check that you’re not drawing conclusions based on very small amounts of data.
 
@@ -197,7 +197,7 @@ flights %>%
 </details>
 
 
-## Ungrouping
+### Ungrouping
 
 If you need to remove grouping, and return to operations on ungrouped data, use `ungroup()`.
 
@@ -212,9 +212,9 @@ flights %>%
   summarise(delay = mean(dep_delay, na.rm = TRUE))
 ```
 
-# Grouping challenges
+## Grouping challenges
 
-## First challenge
+### First challenge
 
 <div class="pencadre">
 
@@ -253,7 +253,7 @@ flights %>%
 </p>
 </details>
 
-## Second challenge
+### Second challenge
 
 <div class="pencadre">
 Is the proportion of canceled flights by day of the week related to the average departure delay?
@@ -346,7 +346,7 @@ flights %>%
 </p>
 </details>
 
-## Third challenge
+### Third challenge
 
 <div class="pencadre">
 Which carrier has the worst delays?
@@ -388,4 +388,4 @@ flights %>%
 </p>
 </details>
 
-## See you in [R.6: tidydata](https://can.gitbiopages.ens-lyon.fr/R_basis/session_6/)
+### See you in [R.6: tidydata](https://can.gitbiopages.ens-lyon.fr/R_basis/session_6/)
diff --git a/session_6/session_6.Rmd b/session_6/session_6.Rmd
index 5188b93..e11b3cd 100644
--- a/session_6/session_6.Rmd
+++ b/session_6/session_6.Rmd
@@ -14,13 +14,13 @@ knitr::opts_chunk$set(echo = TRUE)
 knitr::opts_chunk$set(comment = NA)
 ```
 
-# Introduction
+## Introduction
 
 Until now we have worked with data already formated in a *nice way*.
 In the `tidyverse` data formated in a *nice way* are called **tidy**
 The goal of this practical is to understand how to transform an hugly blob of information into a **tidy** data set.
 
-## Tidydata
+### Tidydata
 
 There are three interrelated rules which make a dataset tidy:
 
@@ -63,9 +63,9 @@ The data is a subset of the data contained in the World Health Organization Glob
 </p>
 </details>
 
-# Pivoting data
+## Pivoting data
 
-## pivot longer
+### pivot longer
 
 ```{r, echo=FALSE, out.width='100%'}
 knitr::include_graphics('img/pivot_longer.png')
@@ -100,7 +100,7 @@ long_example <- wide_example %>%
   pivot_longer(-X1, names_to = "V1", values_to = "V2")
 ```
 
-### Exercice
+#### Exercice
 
 <div class="pencadre">
 Visualize the `table4a` dataset (you can use the `View()` function).
@@ -137,7 +137,7 @@ table4a %>%
 </p>
 </details>
 
-## pivot wider 
+### pivot wider 
 
 ```{r, echo=FALSE, out.width='100%'}
 knitr::include_graphics('img/pivot_wider.png')
@@ -153,7 +153,7 @@ long_example %>% pivot_wider(names_from = V1,
 ```
 
 
-### Exercice
+#### Exercice
 
 <div class="pencadre">
 Visualize the `table2` dataset
@@ -174,9 +174,9 @@ table2 %>%
 </p>
 </details>
 
-# Merging data
+## Merging data
 
-## Relational data
+### Relational data
 
 To avoid having a huge table and to save space, information is often splited between different tables.
 
@@ -192,7 +192,7 @@ flights2 <- flights %>%
   select(year:day, hour, origin, dest, tailnum, carrier)
 ```
 
-## Relational schema
+### Relational schema
 
 The relationships between tables can be seen in a relational graph. The variables used to connect each pair of tables are called keys. A key is a variable (or set of variables) that uniquely identifies an observation.
 
@@ -200,7 +200,7 @@ The relationships between tables can be seen in a relational graph. The variable
 knitr::include_graphics('img/relational-nycflights.png')
 ```
 
-## Joints
+### Joints
 
 If you have to combine data from 2 tables in a a new table, you will use `joints`.
 
@@ -216,7 +216,7 @@ Small concrete examples:
 knitr::include_graphics('img/overview_joins.png')
 ```
 
-### `inner_joint()`
+#### `inner_joint()`
 
 keeps observations in `x` AND `y`
 
@@ -225,7 +225,7 @@ flights2 %>%
   inner_join(airlines)
 ```
 
-### `left_joint()`
+#### `left_joint()`
 
 keeps all observations in `x`
 
@@ -234,7 +234,7 @@ flights2 %>%
   left_join(airlines)
 ```
 
-### `right_joint()`
+#### `right_joint()`
 
 keeps all observations in `y`
 
@@ -243,7 +243,7 @@ flights2 %>%
   right_join(airlines)
 ```
 
-### `full_joint()`
+#### `full_joint()`
 
 keeps all observations in `x` and `y`
 
@@ -252,7 +252,7 @@ flights2 %>%
   full_join(airlines)
 ```
 
-## Defining the key columns
+### Defining the key columns
 
 The default, `by = NULL`, uses all variables that appear in both tables, the so called natural join.
 
@@ -291,7 +291,7 @@ flights2 %>%
   left_join(airports, by = c("origin" = "faa"), suffix = c(".dest",".origin"))
 ```
 
-## Filtering joins
+### Filtering joins
 
 Filtering joins match observations in the same way as mutating joins, but affect the observations, not the variables. There are two types:
 
@@ -306,7 +306,7 @@ flights %>%
   semi_join(top_dest)
 ```
 
-## Set operations
+### Set operations
 
 These expect the x and y inputs to have the same variables, and treat the observations like sets:
 
@@ -318,4 +318,4 @@ These expect the x and y inputs to have the same variables, and treat the observ
 knitr::include_graphics('img/overview_set.png')
 ```
 
-## See you in [R.7: String & RegExp](https://can.gitbiopages.ens-lyon.fr/R_basis/session_7/)
+### See you in [R.7: String & RegExp](https://can.gitbiopages.ens-lyon.fr/R_basis/session_7/)
diff --git a/session_7/session_7.Rmd b/session_7/session_7.Rmd
index 7ada9ea..96633e9 100644
--- a/session_7/session_7.Rmd
+++ b/session_7/session_7.Rmd
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(echo = TRUE)
 knitr::opts_chunk$set(comment = NA)
 ```
 
-# Introduction
+## Introduction
 
 In the previous session, we have often overlooked a particular type of data, the **string**.
 In R a sequence of characters is stored as a string.
@@ -36,9 +36,9 @@ library(tidyverse)
 </p>
 </details>
 
-# String basics
+## String basics
 
-## String definition
+### String definition
 
 A string can be defined within double `"` or simple `'` quote
 
@@ -68,7 +68,7 @@ single_quote <- '\'' # or "'"
 If you want to include a literal backslash, you’ll need to double it up: `"\\"`.
  
  
-## String representation
+### String representation
 
 The printed representation of a string is not the same as string itself
 
@@ -83,7 +83,7 @@ writeLines(x)
 Some characters have a special representation, they are called **special characters**.
 The most common are `"\n"`, newline, and `"\t"`, tabulation, but you can see the complete list by requesting help on `"`: `?'"'`
 
-## String operation
+### String operation
 
 You can perform basic operation on strings like
 
@@ -120,7 +120,7 @@ str_to_lower(x)
 str_sort(x)
 ```
 
-# Matching patterns with regular expressions
+## Matching patterns with regular expressions
 
 Regexps are a very terse language that allows you to describe patterns in strings.
 
@@ -182,13 +182,13 @@ writeLines(x)
 str_view(x, "\\\\")
 ```
 
-## Exercises
+### Exercises
 
 - Explain why each of these strings doesn’t match a \: "`\`", "`\\`", "`\\\`".
 - How would you match the sequence `"'\`?
 - What patterns will the regular expression `\..\..\..` match? How would you represent it as a string?
 
-## Anchors
+### Anchors
 
 Until now we searched for patterns anywhere in the target string. But we can use anchors to be more precise.
 
@@ -209,7 +209,7 @@ x <- c("apple pie", "apple", "apple cake")
 str_view(x, "^apple$")
 ```
 
-## Exercices
+### Exercices
 
 - How would you match the literal string `"$^$"`?
 - Given the corpus of common words in stringr::words, create regular expressions that find all words that:
@@ -220,7 +220,7 @@ str_view(x, "^apple$")
 
 Since this list is long, you might want to use the match argument to `str_view()` to show only the matching or non-matching words.
 
-## Character classes and alternatives
+### Character classes and alternatives
 
 In regular expression we have special character and patterns that match groups of characters.
 
@@ -241,7 +241,7 @@ You can use alternations to pick between one or more alternative patterns. For e
 str_view(c("grey", "gray"), "gr(e|a)y")
 ```
 
-## Exercices
+### Exercices
 
 Create regular expressions to find all words that:
 
@@ -250,7 +250,7 @@ Create regular expressions to find all words that:
 - End with ed, but not with eed.
 - End with ing or ise.
 
-## Repetition
+### Repetition
 
 Now that you know how to search for groups of characters you can define the number of times you want to see them.
 
@@ -278,7 +278,7 @@ str_view(x, "C{2,}")
 str_view(x, "C{2,3}")
 ```
 
-## Exercices
+### Exercices
 
 - Describe in words what these regular expressions match: (read carefully to see if I’m using a regular expression or a string that defines a regular expression.)
   - `^.*$`
@@ -291,7 +291,7 @@ str_view(x, "C{2,3}")
   - Have two or more vowel-consonant pairs in a row.
 
 
-## Grouping
+### Grouping
 
 You learned about parentheses as a way to disambiguate complex expressions. Parentheses also create a numbered capturing group (number 1, 2 etc.). A capturing group stores the part of the string matched by the part of the regular expression inside the parentheses. You can refer to the same text as previously matched by a capturing group with back references, like `\1`, `\2` etc. 
 
@@ -299,7 +299,7 @@ You learned about parentheses as a way to disambiguate complex expressions. Pare
 str_view(fruit, "(..)\\1", match = TRUE)
 ```
 
-## Exercices
+### Exercices
 
 - Describe, in words, what these expressions will match:
   - `"(.)\1\1"`
@@ -312,7 +312,7 @@ str_view(fruit, "(..)\\1", match = TRUE)
   - Contain a repeated pair of letters (e.g. `“church”` contains `“ch”` repeated twice.)
   - Contain one letter repeated in at least three places (e.g. `“eleven”` contains three `“e”`s.)
 
-## Detect matches
+### Detect matches
 
 ```{r str_view_match, eval=T, cache=T}
 x <- c("apple", "banana", "pear")
@@ -331,7 +331,7 @@ What proportion of common words ends with a vowel?
 mean(str_detect(words, "[aeiou]$"))
 ```
 
-## Combining detection
+### Combining detection
 
 Find all words containing at least one vowel, and negate
 
@@ -346,7 +346,7 @@ no_vowels_2 <- str_detect(words, "^[^aeiou]+$")
 identical(no_vowels_1, no_vowels_2)
 ```
 
-## With tibble
+### With tibble
 
 ```{r str_detecttibble, eval=T, cache=T}
 df <- tibble(
@@ -357,7 +357,7 @@ df %>%
   filter(str_detect(word, "x$"))
 ```
 
-## Extract matches
+### Extract matches
 
 ```{r str_sentences, eval=T, cache=T}
 head(sentences)
@@ -371,7 +371,7 @@ colour_match <- str_c(colours, collapse = "|")
 colour_match
 ```
 
-## Extract matches
+### Extract matches
 
 We can select the sentences that contain a colour, and then extract the colour to figure out which one it is:
 
@@ -381,7 +381,7 @@ matches <- str_extract(has_colour, colour_match)
 head(matches)
 ```
 
-## Grouped matches
+### Grouped matches
 
 Imagine we want to extract nouns from the sentences. As a heuristic, we’ll look for any word that comes after “a” or “the”.
 
@@ -401,11 +401,11 @@ has_noun %>%
   str_match(noun)
 ```
 
-## Exercises
+### Exercises
 
 - Find all words that come after a `number` like `one`, `two`, `three` etc. Pull out both the number and the word.
 
-## Replacing matches
+### Replacing matches
 
 Instead of replacing with a fixed string, you can use back references to insert components of the match. In the following code, I flip the order of the second and third words.
 
@@ -415,13 +415,13 @@ sentences %>%
   head(5)
 ```
 
-## Exercices
+### Exercices
 
 - Replace all forward slashes in a string with backslashes.
 - Implement a simple version of `str_to_lower()` using `replace_all()`.
 - Switch the first and last letters in words. Which of those strings are still words?
 
-## Splitting
+### Splitting
 
 ```{r splitting, eval=T, cache=T}
 sentences %>%
@@ -429,4 +429,4 @@ sentences %>%
   str_split("\\s")
 ```
 
-## See you in [R.8: Factors](https://can.gitbiopages.ens-lyon.fr/R_basis/session_8/)
\ No newline at end of file
+### See you in [R.8: Factors](https://can.gitbiopages.ens-lyon.fr/R_basis/session_8/)
\ No newline at end of file
diff --git a/session_8/session_8.Rmd b/session_8/session_8.Rmd
index 3437826..ad0e404 100644
--- a/session_8/session_8.Rmd
+++ b/session_8/session_8.Rmd
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(echo = TRUE)
 knitr::opts_chunk$set(comment = NA)
 ```
 
-# Introduction
+## Introduction
 
 In this session, you will learn more about the factor type in R.
 Factors can be very useful, but you have to be mindful of the implicit conversions from simple vector to factor !
@@ -35,7 +35,7 @@ library(tidyverse)
 </p>
 </details>
 
-# Creating factors
+## Creating factors
 
 Imagine that you have a variable that records month:
 
@@ -84,7 +84,7 @@ f2
 levels(f2)
 ```
 
-# General Social Survey
+## General Social Survey
 
 ```{r race_count, eval=T, cache=T}
 gss_cat %>%
@@ -99,7 +99,7 @@ ggplot(gss_cat, aes(x = race)) +
   scale_x_discrete(drop = FALSE)
 ```
 
-# Modifying factor order
+## Modifying factor order
 
 It’s often useful to change the order of the factor levels in a visualisation.
 
@@ -134,7 +134,7 @@ relig_summary %>%
     geom_point()
 ```
 
-# `fct_reorder2()`
+## `fct_reorder2()`
 
 Another type of reordering is useful when you are colouring the lines on a plot. `fct_reorder2()` reorders the factor by the `y` values associated with the largest `x` values. This makes the plot easier to read because the line colours line up with the legend.
 
@@ -157,7 +157,7 @@ ggplot(by_age, aes(x = age, y = prop, colour = fct_reorder2(marital, age, prop))
   labs(colour = "marital")
 ```
 
-# Materials
+## Materials
 
 There are lots of material online for R and more particularly on `tidyverse` and `Rstudio`
 
-- 
GitLab