class: center, middle ![:scale 30%](/assets/images/coding_club_logo_1.png) # 25 FEBRUARY 2020 ## INBO coding club Herman Teirlinck
01.05 - Isala Van Diest --- class: center, left ![:scale 100%](/assets/images/20200225/20200225_roomie.png) --- class: center, middle ![:scale 90%](/assets/images/20200225/20200225_data_management.png) --- class: center, middle ### How to get started? Check the [Each session setup](https://inbo.github.io/coding-club/gettingstarted.html#each-session-setup) to get started. ### First time coding club? Check the [First time setup](https://inbo.github.io/coding-club/gettingstarted.html#first-time-setup) section to setup. --- class: center, middle ![:scale 100%](/assets/images/coding_club_sticky_concept.png) --- class: center, middle ### Share your code during the coding session! Go to https://hackmd.io/09qyY42KTXeNK1nOZDB01Q?both
--- class: left, middle ### Install and load the package suite `install.packages("tidyverse")`
`library(tidyverse)` --- class: left, middle ## Download data and source file - Click [20200225/20200225_urban_gaia_policy.txt](https://github.com/inbo/coding-club/blob/master/data/20200225/20200225_urban_gaia_policy.txt) and download* data file to your `/data` folder. - Click [20191024/20191024_species.csv](https://github.com/inbo/coding-club/blob/master/data/20191024/20191024_species.csv) and download* data file to your `/data` folder. - Click [`20200225/20200225_challenges.R`](https://github.com/inbo/coding-club/blob/master/src/20200225/20200225_challenges.R) and download* script file in your `/src` folder. - Click [`20200225/20200225_create_messy_project.R`](https://github.com/inbo/coding-club/blob/master/src/20200225/20200225_create_messy_project.R) and download* script file in your `/src` folder. * __Note__: check the getting started instructions on [how to download a single file](https://inbo.github.io/coding-club/gettingstarted.html#each-session-setup) --- background-image: url(/assets/images/background_challenge_1.png) class: left, middle # Challenge 1. Tidy files and directories Run the code in `20200225/20200225_challenges.R` to create a messy project. Next: - Improve the directory structure and filenames - Improve the code in `1.R` so the figure can be created by anyone and gets stored in a dedicated folder. Tip use: `here()` - use `as.data.frame(list.files(recursive = TRUE))` to show your tidy project structure in the hackmd Get inspired by: - [how to give good names to files (slides)](https://speakerdeck.com/jennybc/how-to-name-files)
![:scale 30%](/assets/images/20200225/20200225_name_files.png) - [this project structure](https://github.com/inbo/coding-club/blob/master/docs/assets/images/20200225/20200225_structure_project.png), a simplified version of Python's [cookiecutter-data-science directory structure] (https://drivendata.github.io/cookiecutter-data-science/#directory-structure)) --- background-image: url(/assets/images/background_challenge_2.png) class: left, middle # Challenge 2. Tidy column names for tabular data Open the downloaded file `20200225/20200225_urban_gaia_policy.txt` and improve the column names. --- class: left, middle # Intermezzo Do you know that: - You can improve column names by using the function `clean_names()` from `janitor` package? - You can rename columns by using tidyverse function `rename` or `select`? --- background-image: url(/assets/images/background_challenge_3.png) class: left, middle # Challenge 3. Tidy code Based on [the INBO style guide for R code](https://inbo.github.io/tutorials/tutorials/styleguide_r_code/) or [the tidyverse style guide on syntax](https://style.tidyverse.org/syntax.html) improve the code of [20200225/20200225_challenges.R](https://github.com/inbo/coding-club/blob/master/src/20200225/20200225_challenges.R) (this is the R file you are working in) --- class: left, middle # Resources - [The tidyverse style guide](https://style.tidyverse.org/files.html): style everything that has to do with coding (R filenames, code syntax, documentation, packages) - [What they forgot to teach you about R](https://rstats.wtf/index.html) - [workflow-projects in r4ds](https://r4ds.had.co.nz/workflow-projects.html) - [Edinborough coding club](https://ourcodingclub.github.io/course/wiz-viz/index.html) --- class: center, middle ![:scale 30%](/assets/images/coding_club_logo_1.png) Room: Herman Teirlinck - 01.05 - Isala Van Diest
Date: __26/03/2020__, van 10:00 tot 12:00
Title: **Wo
R
king with GIS data**
(registration announced via DG_useR@inbo.be)