layout: true <!-- this adds the link footer to all slides, depends on footer-small class in css--> <div class="footer-small"><span>https://github.com/mjfrigaard/csuc-data-journalism</div> --- name: title-slide class: title-slide, center, middle, inverse # Using the `goodenuffR` package #.fancy[Everything...in its right place] <br> .large[by Martin Frigaard] Written: October 21 2021 Updated: November 30 2021 .footer-large[.right[.fira[ <br><br><br><br><br>[Created using the "λέξις" theme](https://jhelvy.github.io/lexis/index.html#what-does-%CE%BB%CE%AD%CE%BE%CE%B9%CF%82-mean) ]]] --- class: inverse, center, top background-image: url(img/goodenuffR.png) background-position: 50% 70% background-size: 35% ## `goodenuffR` = good enuff practices in R computing --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Outline .leftcol[ ### 1) The Problem ### 2) A Solution ### 3) Installation ### 4) Quick Start ] .rightcol[ ### 5) Package functions + `goodenuff_code()` + `goodenuff_collab()` + `goodenuff_data()` + `goodenuff_doc()` + `goodenuff_results()` + `goodenuff_files()` ### 6) Using `goodenuffR` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # The Problem .leftcol35[ > *Where is my stuff?* ] .rightcol65[ ### [THE VERGE: FILE NOT FOUND](https://www.theverge.com/22684730/students-file-folder-directory-structure-education-gen-z) <img src="img/verge-file-not-found.png" width="95%" height="95%" /> ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # The Problem .leftcol70[ <img src="img/files-tweet-01.png" width="100%" height="100%" /> ] -- .rightcol30[ > *Store stuff in a particular place* ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # The Problem .leftcol[ <img src="img/files-tweet-02.png" width="100%" height="100%" /> ] -- .rightcol[ > *Most soul-destroying "bug" when trying to learn programming* ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # A Solution: `goodenuffR`! ### Based on the excellent paper, [*Good enough practices in scientific computing*](https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005510) by Greg Wilson, Jennifer Bryan, Karen Cranston, Justin Kitzes, Lex Nederbragt, Tracy K. Teal -- .border[ <img src="img/plos-gepisc.png" width="60%" height="60%" style="display: block; margin: auto;" /> ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # A Solution #### The paper focuses on... > *"a minimum set of tools and techniques that we believe every researcher can and should consider adopting"* -- #### Specifically .leftcol[ .medium[ + Data management + Software + Collaboration ]] .rightcol[ .medium[ + Project organization + Tracking changes + Manuscripts ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # A Solution .leftcol[ #### `goodenuffR` focuses on: + Data management + Project organization ] -- .rightcol[ #### Specifically .code70[ ```bash |-- CITATION |-- README |-- LICENSE |-- requirements.txt |-- data | |-- birds_count_table.csv |-- doc | |-- notebook.md | |-- manuscript.md | |-- changelog.txt |-- results | |-- summarized_results.csv |-- src | |-- sightings_analysis.py | |-- runall.py ``` ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Installation <br> ### Available on GitHub here: https://github.com/mjfrigaard/goodenuffR -- <br> ### Install `goodenuffR` using the code below: ```r install.packages("devtools") devtools::install_github("mjfrigaard/goodenuffR") ``` --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Quick Start .leftcol35[ ### In a fresh RStudio Session ] .rightcol65[.border[ <img src="img/goodenuffR-fresh.png" width="100%" height="100%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Quick Start .leftcol35[ ### 1) Install `devtools`, then install and load `goodenuffR` ] .rightcol65[.border[ <img src="img/goodenuffR-install-load.png" width="65%" height="65%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Quick Start .leftcol35[ ### 2) Enter a project name ### 3) Enter the folder path for your project ] .rightcol65[ <br><br><br><br> ```r goodenuffR::goodenuff_project( project_name = "my awesome project", folder_path = "/Users/mjfrigaard/Projects") ``` #### TIP: *use `getwd()` in the Console or `pwd` in the Terminal to locate current folder* ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Quick Start .leftcol35[ ### RStudio will open a new session for your project ] .leftcol65[.border[ <img src="img/goodenuffR-new.png" width="90%" height="90%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Quick Start .leftcol35[ ### 4) Run .code70[ ```r goodenuffR::goodenuff_files() ``` ]] .leftcol65[.border[ <img src="img/goodenuffR-run.png" width="80%" height="80%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Quick Start .leftcol35[ ### Now you're good (enuff) to go! ] .leftcol65[.border[ <img src="img/goodenuffR-ready.png" width="80%" height="80%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions #### `goodenuff_code()` .leftcol[ ### Paper - *readable, reusable, and testable* - *short, single-purpose functions with clearly-defined inputs and outputs* - *name all files to reflect their content or function* ] .rightcol[ ### `goodenuffR` ```r goodenuffR::goodenuff_code() # └── code # ├── 01-import.R # ├── 02-tidy.R # ├── 03-wrangle.R # ├── 04-visualize.R # ├── 05-model.R # ├── 06-communicate.R # └── runall.R ``` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions #### `goodenuff_code()` .leftcol[ ### Paper - *Place a brief explanatory comment at the start of every program* ] .rightcol[ ### `goodenuffR` Each `code` file has a header: ```r #======================= # This is code to create: # Authored by and feedback to: # MIT License # Version: #======================= ``` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions #### `goodenuff_collab()` .leftcol[ ### Paper - *Make the project citable* - *Make the license explicit* - *Create an overview of your project* - *Make dependencies and requirements explicit* ] .rightcol[ ### `goodenuffR` ```r goodenuffR::goodenuff_collab() # └── CITATION # └── LICENSE # └── README.Rmd # └── requirements.txt ``` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions #### `goodenuff_data()` .leftcol[ ### Paper - *Save the raw data* - *Record all the steps used to process data* ] .rightcol[ ### `goodenuffR` ```r goodenuffR::goodenuff_data() # data # ├── README.md # └── raw ``` *Folder for keeping `raw/` data separate from other data files* *Document in `README.md`* ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions ### `goodenuff_data()` (BONUS!) `data/README.md` provides some guidance on storing and documenting data. .code60[ ``` # Project Data For guidance please see: https://help.osf.io/hc/en-us/articles/360019739054-How-to-Make-a-Data-Dictionary ## Additional Resources 1. Sharing data http://bit.ly/data-4-sharing 2. Data in spreadsheets http://bit.ly/data-in-sheets 3. External data (https://r-pkgs.org/) https://r-pkgs.org/data.html source: https://swcarpentry.github.io/good-enough-practices-in-scientific-computing/ ``` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions #### `goodenuff_doc()` .leftcol[ ### Paper - *Put text documents associated with the project in the `doc` directory* - *Add a file called `CHANGELOG.txt` to the project's docs subfolder* - *a running lab notebook describing various ideas for the project and how these were implemented* ] .rightcol[ ### `goodenuffR` ```r goodenuffR::goodenuff_doc() # docs # ├── changelog.txt # ├── manuscript.Rmd # └── notebook.Rmd ``` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions #### `goodenuff_results()` .leftcol[ ### Paper - *Put raw data and metadata in a `data/` directory and files generated during cleanup and analysis in a `results/` directory* ] .rightcol[ ### `goodenuffR` ```r goodenuffR::goodenuff_results() # results # ├── figures # ├── manuscript # └── tables ``` ] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Package functions .leftcol[ #### `goodenuff_files()` ] .rightcol[ .border[ <img src="img/goodenuffR-files.png" width="65%" height="65%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% ## BONUS: RMarkdown Template .leftcol[ ### `goodenuffR` also comes with a `rmarkdown` template: ] .rightcol[ <br> .border[ <img src="img/new-rmd.png" width="75%" height="75%" style="display: block; margin: auto;" /> ]] --- class: left, top background-image: url(img/goodenuffR.png) background-position: 93% 8% background-size: 8% # Thank you! ## Feedback to ### - `@mjfrigaard` on Github and Twitter ### - `mjfrigaard(at)pm.me` email