Skip to content
Snippets Groups Projects
Commit 98f642e9 authored by Carine Rey's avatar Carine Rey
Browse files

update session5

parent 49987e1f
Branches
No related tags found
1 merge request!6Switch to main as default branch
--- ---
title: "R#5: Pipping and grouping" title: "R#5: Pipping and grouping"
author: "Laurent Modolo [laurent.modolo@ens-lyon.fr](mailto:laurent.modolo@ens-lyon.fr)" author: "Laurent Modolo [laurent.modolo@ens-lyon.fr](mailto:laurent.modolo@ens-lyon.fr)"
date: "2021" date: "2022"
output: output:
rmdformats::downcute: rmdformats::downcute:
self_contain: true self_contain: true
use_bookdown: true use_bookdown: true
default_style: "light" default_style: "light"
lightbox: true lightbox: true
css: "http://perso.ens-lyon.fr/laurent.modolo/R/src/style.css" css: "../www/style_Rmd.css"
--- ---
```{r include=FALSE}
library(fontawesome)
```
 `r fa(name = "fas fa-house", fill = "grey", height = "1em")`  https://can.gitbiopages.ens-lyon.fr/R_basis/
```{r setup, include=FALSE} ```{r setup, include=FALSE}
rm(list=ls()) rm(list=ls())
knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(echo = TRUE)
...@@ -78,8 +84,8 @@ Try to pipe operators to rewrite your precedent code with only **one** variable ...@@ -78,8 +84,8 @@ Try to pipe operators to rewrite your precedent code with only **one** variable
<p> <p>
```{r pipe_example_b, include=TRUE} ```{r pipe_example_b, include=TRUE}
flights_md2 <- flights %>% flights_md2 <- flights %>%
mutate(most_delay = min_rank(desc(dep_delay))) %>% mutate(most_delay = min_rank(desc(dep_delay))) %>%
filter(most_delay < 10) %>% filter(most_delay < 10) %>%
arrange(most_delay) arrange(most_delay)
``` ```
</p> </p>
...@@ -164,8 +170,6 @@ summ_delay_filghts <- flights %>% ...@@ -164,8 +170,6 @@ summ_delay_filghts <- flights %>%
filter(dest != "HNL") %>% filter(dest != "HNL") %>%
filter(delay < 40 & delay > -20) filter(delay < 40 & delay > -20)
ggplot(data = summ_delay_filghts, mapping = aes(x = dist, y = delay, size = count)) + ggplot(data = summ_delay_filghts, mapping = aes(x = dist, y = delay, size = count)) +
geom_point() + geom_point() +
geom_smooth(method = lm, se = FALSE) + geom_smooth(method = lm, se = FALSE) +
...@@ -395,4 +399,4 @@ flights %>% ...@@ -395,4 +399,4 @@ flights %>%
</p> </p>
</details> </details>
## See you in [R.6: tidydata](http://perso.ens-lyon.fr/laurent.modolo/R/session_6/) ## See you in [R.6: tidydata](https://can.gitbiopages.ens-lyon.fr/R_basis/session_6/)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment