class: center, middle, inverse, title-slide .title[ # Oddly Satisfying ] .subtitle[ ## Find delight in the mundane ] .author[ ### Liz Roten ] .date[ ### July 27, 2022 ] --- .center[ <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1);">] <!-- I went to open the existing materials, and --> -- .center[ ## it was bad] <!-- This project was pitched to me as a quick data science win. --> <!-- It would be straightforward, simple, and logical --> <!-- We are just updating some data --> <!-- This was a lie. --> <!-- In fact, what was left to me was a mess --> --- ## ...how bad? <!-- You might be asking, why is this so bad? --> <!-- and because there are so many and you can't read the text, let me describe it --> <!-- we have several things going on --> -- .pull-left[ <img src="assets/fig/extant-dirs.png" alt="A screenshot of many files" style="max-width: 75%"> ] -- .pull-right[ <!-- Which one is *actually* the final one? Is it the most recent chronologically or the most recently opened or edited? --> <li>Multiple final reports</li> ] -- .pull-right[ <!-- some document are marked as revised. but who revised them, and why were they revised?--> <li>Multiple revised documents</li> ] -- .pull-right[ <!-- In this excel document, there are several sheets with interdependent formulas One sheet has over 15,000 rows! --> <li>One Excel workbook, with all the analysis</li> ] <!-- I realized that this project was going to be more than I thought it was I also got really into this internet phenomenon of oddly satisfying things--> <!-- what is an oddly satisfying thing? --> --- ## Oddly satisfying -- .center[ <img src="assets/fig/crab_with_fish.jpg" alt="A tiny crab holding a tiny fish" height="350px"> ] --- -- .pull-left[ ### Smoothie! <video id="smoothie" controls muted height="400px" width="500px" src="assets/fig/smoothie_satisfying.mp4" type="video/mp4"> </video>] -- .pull-right[ ### Tarts! <video id="tart-icing" controls muted height="400px" width="500px" src="assets/fig/tart_icing.mp4" type="video/mp4"> </video>] --- <!-- there is something about this type of video that just calms my soul --> I decided to take my truck, .center[ <br> <br> <div> <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1); position: absolute;left: 447px;top: 400px;"> <img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/microsoft/310/crying-face_1f622.png" alt="Crying face emoji" width="70px" style="position: absolute; top: 321px; left: 47%"> </div> ] --- I decided to take my truck, and make it the best truck .center[ <div class="center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Rainbow-diagram-ROYGBIV.svg/800px-Rainbow-diagram-ROYGBIV.svg.png?20200807113632" alt="A classic rainbow with 8 colors" style= "position:relative;"> <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1); position: absolute;left: 447px;top: 400px;"> <img src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/microsoft/310/grinning-face-with-big-eyes_1f603.png" alt="Grinning face with big eyes emoji" width="70px" style="position: absolute; top: 321px; left: 47%"> </div> ] --- ## 1. 🔥 Assess the damage -- ## 2. 📄 Do and document -- ## 3. 🎁 Leave a gift --- class: inverse center middle # Assess the damage --- ## Complete an intake -- - Read through everything --- ## Complete an intake - Read through everything .primary[-- actually everything] -- - Make a hate list <!-- Not of people! Just bad documentation Maybe the longform documentation doesn't match whats happening in the Excel workbook Maybe some of the notes are super vague--> -- <!-- You may find yourself in a place where the long-form PDF documentation doesn't align with what is happening in an Excel workbook --> <!-- This is the time to resolve that, and start thinking about how you want to --> - Replicate findings/results -- - Find your ✨thing✨ --- class: center middle animated fadeInUp <!-- but, most importantly, you must find your thing --> <div id="thing"> .center.animated.fadeInUp[ ## Find your ✨thing✨ ] </div> --- <!-- Find some aspect of this project you can make shine. --> .panelset.sideways[ .panel[.panel-name[Plots?] <!-- finally see what that pretty plot on twitter is all about --> <img src="assets/fig/plot_score_abs_change_combo-1.png" alt="a ggplot with multiple data distribution visualization methods" width="70%"> ] .panel[.panel-name[Maps?] <!-- prepare to make some bespoke ggplot2 legends --> <img src="assets/fig/map_all_tiers-1.png" alt="a ggplot with multiple data distribution visualization methods" width="70%"> ] .panel[.panel-name[Speed?] <!-- watch out, because your machine is going to be running *hot* --> ```r # Conflate proposed corridors with MnDOT AADT and HCAADT ----- proposed_conflation_match <- purrr::map_dfr( 1:nrow(all_prop_corridors), function(x) { first_join <- sf::st_join(all_prop_corridors[x, ] %>% sf::st_transform(26915), aadt %>% unique() %>% sf::st_transform(26915), largest = FALSE, left = TRUE) ... }) ``` ] ] --- Your ✨thing✨ is what will power the project <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1); position: absolute;left: 447px;top: 400px;"> -- and keep you sane --- class: inverse center middle # Do and document --- ## Complete the work, document along the way -- > Documentation is a love letter to your future self. - Damien Conway --- ### Modularize .pull-left[ <img src="assets/fig/cranberry-tart.webp" alt="An image of a cranberry tart, cut into even slices with beautiful decoration" style="transform: scaleX(-1);"> ] -- .pull-right[ No single script more than 500 lines ] --- ### Modularize .pull-left[ <!-- here, we have a bulky script that may do more than we actually need it to --> ```r all_prop_corridors <- corridors %>% filter(proposed == TRUE) proposed_conflation_match <- purrr::map_dfr( 1:nrow(all_prop_corridors), function(x) { first_join <- sf::st_join( all_prop_corridors[x, ], aadt %>% unique(), largest = FALSE, left = TRUE) ... }) ``` ] -- .pull-right[ <!-- here, we've broken out each script into its core functions. I can call load_pkgs.R from anywhere, and I know it will JUST call library(). You can also use numeric prefixes 00, 01, 02 to denote sequential operations--> ```r source("load_pkgs.R") source("load_data.R") source("01_conflate_corridors.R") source("02_score_clusters.R") source("03_score_facilities.R") ``` ] --- ### Modularize .pull-left[ <!-- here, we have a bulky script that may do more than we actually need it to --> ```r all_prop_corridors <- corridors %>% filter(proposed == TRUE) proposed_conflation_match <- purrr::map_dfr( 1:nrow(all_prop_corridors), function(x) { first_join <- sf::st_join( all_prop_corridors[x, ], aadt %>% unique(), largest = FALSE, left = TRUE) ... }) ``` ] .pull-right[ <!-- here, we've broken out each script into its core functions. I can call load_pkgs.R from anywhere, and I know it will JUST call library(). You can also use numeric prefixes 00, 01, 02 to denote sequential operations--> ```r *source("load_pkgs.R") source("load_data.R") source("01_conflate_corridors.R") source("02_score_clusters.R") source("03_score_facilities.R") ``` ] --- ### Modularize .pull-left[ <!-- here, we have a bulky script that may do more than we actually need it to --> ```r all_prop_corridors <- corridors %>% filter(proposed == TRUE) proposed_conflation_match <- purrr::map_dfr( 1:nrow(all_prop_corridors), function(x) { first_join <- sf::st_join( all_prop_corridors[x, ], aadt %>% unique(), largest = FALSE, left = TRUE) ... }) ``` ] .pull-right[ <!-- here, we've broken out each script into its core functions. I can call load_pkgs.R from anywhere, and I know it will JUST call library(). You can also use numeric prefixes 00, 01, 02 to denote sequential operations--> ```r source("load_pkgs.R") *source("load_data.R") source("01_conflate_corridors.R") source("02_score_clusters.R") source("03_score_facilities.R") ``` ] --- ## Make a bespoke README -- .readme-def[ > <i>noun</i> > an explanatory document that accompanies computer files or software ] <br/> -- ![:col_header Context] --- ## Make a bespoke README .readme-def[ > <i>noun</i> > an explanatory document that accompanies computer files or software ] <br/> ![:col_header Context, Structure] --- ## Make a bespoke README .readme-def[ > <i>noun</i> > an explanatory document that accompanies computer files or software ] <br/> ![:col_header Context, Structure, Key information] --- .panelset[ .panel[.panel-name[Context] .pull-left[ <img width="600px" src="assets/fig/readme-intro.png" alt="A screenshot of a README document"> ] .pull-right[ - What even **is** this thing? - Why does this thing exist? - What is the history? ] .panel[.panel-name[Structure] .pull-left[ <img width="600px" src="assets/fig/readme-structure.png" alt="A screenshot of a README document">] .pull-right[ - How is it organized? <!-- Please, let there be a system --> - Where does the data live? - Where do you actually **do** the thing? ] ] .panel[.panel-name[Key] .pull-left[<img width="600px" src="assets/fig/readme-key.png" alt="A screenshot of a README document"> ] .pull-right[ - Hate list -> Love list - At the most fundamental level, what is the operative component and how is it done? - Link to specific scripts! ] ] ] ] --- class: inverse center middle # Leave a gift, ## not a mystery --- ## Post project debrief .center[ <video id="gift-video" controls muted height="400px" width="500px" src="assets/fig/leave-a-gift.mp4" type="video/mp4"> </video> ] --- ## Post project debrief .pull-left[ .center[ <img width="200px" src="assets/fig/leave-a-gift.jpg" alt="A still image of a beautifully wrapped gift">] ] .pull-right[ - Take a break! <!-- Once the project is complete, and really truly complete, take a break --> <!-- - You should be a slightly different person than when you closed the project --> ] --- ## Post project debrief .pull-left[ .center[ <img width="200px" src="assets/fig/leave-a-gift.jpg" alt="A still image of a beautifully wrapped gift">] ] .pull-right[ - Take a break! - Condense and clarify ] --- .pull-left[ ## Yikes <!-- here we have all the intermediate rmarkdowns I wrote when I was evaluating the project and conducting the analysis. --> <!-- A lot of these were dead ends, and I don't need them taking up space in the future. --> <PRE class='fansi fansi-output'><CODE>## <span style='color: #0000BB; font-weight: bold;'>../../MTS/truck-corridor-study/</span> ## ├── <span style='color: #00BB00;'>00_sample_corridors.Rmd</span> ## ├── <span style='color: #00BB00;'>01_conflate_corridors.Rmd</span> ## ├── <span style='color: #00BB00;'>02_calibrate_streetlight.Rmd</span> ## ├── <span style='color: #00BB00;'>03_review_streetlight.Rmd</span> ## ├── <span style='color: #00BB00;'>04_calibrate_fun_classes.Rmd</span> ## ├── 04_calibrate_fun_classes.html ## ├── <span style='color: #00BB00;'>05_compare_scores.Rmd</span> ## ├── 05_compare_scores.html ## ├── <span style='color: #00BB00;'>06_generate_deliverables.Rmd</span> ## ├── 06_generate_deliverables.html ## ├── <span style='color: #0000BB; font-weight: bold;'>06_generate_deliverables_files</span> ## ├── <span style='color: #00BB00;'>07_review_corridors.Rmd</span> ## ├── 07_review_corridors.html ## ├── <span style='color: #00BB00;'>08_corridor_additions.Rmd</span> ## ├── 08_corridor_additions.html ## ├── <span style='color: #0000BB; font-weight: bold;'>R</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>README.Rmd</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>README.md</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>Tableau</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>data</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>initial_assessment.Rmd</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>initial_assessment.html</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>logo.png</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>output</span> ## ├── <span style='color: #00BB00;'>potential_corridor_additions.R</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>references.bib</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>scrap</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>style.css</span> ## └── <span style='color: #00BB00; font-weight: bold;'>truck-corridor-study.Rproj</span> </CODE></PRE> ] -- .pull-right[ ## Yes <!-- here, I have dramatically reduced the number of markdowns, down to just three core documents --> <!-- A README, a Summary, and Methods --> <PRE class='fansi fansi-output'><CODE>## <span style='color: #0000BB; font-weight: bold;'>../../MTS/truck-corridor-study/</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>R</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>README.Rmd</span> ## ├── README.md ## ├── <span style='color: #00BB00;'>Summary.Rmd</span> ## ├── Summary.html ## ├── <span style='color: #0000BB; font-weight: bold;'>Summary_files</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>Tableau</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>data</span> ## ├── <span style='color: #0000BB; font-weight: bold;'>figures</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>logo.png</span> ## ├── <span style='color: #00BB00;'>methods.Rmd</span> ## ├── methods.html ## ├── <span style='color: #0000BB; font-weight: bold;'>scrap</span> ## ├── <span style='color: #00BB00; font-weight: bold;'>style.css</span> ## └── <span style='color: #00BB00; font-weight: bold;'>truck-corridor-study.Rproj</span> </CODE></PRE> ] --- ## Not only **what**, but **why** .panelset.sideways[ .panel[.panel-name[What] <!-- this is a factual statement, but doesn't tell us anything about why we would 2019 over any other year --> We used 2019 traffic data ] .panel[.panel-name[Why] <!-- here, we add some more context.--> <!-- 2020 was a dumpster fire, aka, anomalous, year, so we went with 2019. --> We used 2019 traffic data __because__ 2020 was anomalous ] ] --- ## Not only **what**, but **why** .panelset.sideways[ .panel[.panel-name[What] <!-- this is a factual statement, but doesn't tell us anything about why we would 2019 over any other year --> We set the tier breaks at 15.4 and 26.2 points ] .panel[.panel-name[Why] <!-- here, we add some more context --> We set the tier breaks at 15.4 and 26.2 points __because__ planners used their best judgement ] ] --- ## Aim for reproducibility -- - Record package versions -- - Try `{groundhog}`, `{pak}`, or `{renv}` -- - Timestamp outputs -- - With a year, month, **and** day! --- class: center <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1); position: relative; top: 192px"> --- class: center # I still don't care about trucks <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1);"> -- but everyone in my office knows about this documentation -- and I'm very proud of my work. --- .center[ <img src="assets/fig/mndot_4plus_single.png" alt="A black and white line art illustration of a large truck" style="transform: scaleX(-1);position: absolute;max-width: 19%;top: 336px;right: 500px;"> <img src="assets/fig/crab_with_fish.jpg" alt="A tiny crab holding a tiny fish" height="550px"> ] --- class: center, middle # Thanks! [lizroten.com/oddly](https://lizroten.com/oddly) --- class: end-matter #### Project packages Aden-Buie, G. (2021). _xaringanthemer: Custom xaringan CSS Themes_. R package version 0.4.1. URL: [https://CRAN.R-project.org/package=xaringanthemer](https://CRAN.R-project.org/package=xaringanthemer). Aden-Buie, G. and M. T. Warkentin (2022). _xaringanExtra: Extras and Extensions for xaringan Slides_. R package version 0.7.0. URL: [https://CRAN.R-project.org/package=xaringanExtra](https://CRAN.R-project.org/package=xaringanExtra). Derks, K. (2022). _aRtsy: Generative Art with ggplot2_. R package version 0.1.8. URL: [https://CRAN.R-project.org/package=aRtsy](https://CRAN.R-project.org/package=aRtsy). Hester, J., H. Wickham, and G. Csárdi (2021). _fs: Cross-Platform File System Operations Based on libuv_. R package version 1.5.2. URL: [https://CRAN.R-project.org/package=fs](https://CRAN.R-project.org/package=fs). McLean, M. W. (2017). "RefManageR: Import and Manage BibTeX and BibLaTeX References in R". In: _The Journal of Open Source Software_. DOI: [10.21105/joss.00338](https://doi.org/10.21105%2Fjoss.00338). \-\-\- (2020). _RefManageR: Straightforward BibTeX and BibLaTeX Bibliography Management_. R package version 1.3.0. URL: [https://github.com/ropensci/RefManageR/](https://github.com/ropensci/RefManageR/). \-\-\- (2014). _Straightforward Bibliography Management in R Using the RefManager Package_. arXiv: 1403.2036 [cs.DL]. URL: [https://arxiv.org/abs/1403.2036](https://arxiv.org/abs/1403.2036). Müller, K. and H. Wickham (2022). _tibble: Simple Data Frames_. R package version 3.1.8. URL: [https://CRAN.R-project.org/package=tibble](https://CRAN.R-project.org/package=tibble). Pedersen, T. L. (2020). _patchwork: The Composer of Plots_. R package version 1.1.1. URL: [https://CRAN.R-project.org/package=patchwork](https://CRAN.R-project.org/package=patchwork). R Core Team (2022). _R: A Language and Environment for Statistical Computing_. R Foundation for Statistical Computing. Vienna, Austria. URL: [https://www.R-project.org/](https://www.R-project.org/). Thoen, E. (2022). _dutchmasters: Colour Pallettes based on Famous Paintings_. R package version 0.1.0. Wickham, H., R. François, L. Henry, et al. (2022). _dplyr: A Grammar of Data Manipulation_. R package version 1.0.9. URL: [https://CRAN.R-project.org/package=dplyr](https://CRAN.R-project.org/package=dplyr). Xie, Y. (2015). _Dynamic Documents with R and knitr_. 2nd. ISBN 978-1498716963. Boca Raton, Florida: Chapman and Hall/CRC. URL: [https://yihui.org/knitr/](https://yihui.org/knitr/). \-\-\- (2014). "knitr: A Comprehensive Tool for Reproducible Research in R". In: _Implementing Reproducible Computational Research_. Ed. by V. Stodden, F. Leisch and R. D. Peng. ISBN 978-1466561595. Chapman and Hall/CRC. URL: [http://www.crcpress.com/product/isbn/9781466561595](http://www.crcpress.com/product/isbn/9781466561595). \-\-\- (2022). _knitr: A General-Purpose Package for Dynamic Report Generation in R_. R package version 1.39. URL: [https://yihui.org/knitr/](https://yihui.org/knitr/). --- class: end-matter #### Multimedia sources <ul style="font-size: 15pt; text-align: left;"> - Mini tart icing https://gfycat.com/needygivingbufeo, as performed by [@jeanimbert](https://www.instagram.com/jeanimbert/?hl=en) - Satisfying smoothie from [fenitas.nl](https://www.tiktok.com/@fenitas.nl/video/7093892979659738373) - Tiny crab with tiny fish via [Reddit](https://www.reddit.com/r/oddlysatisfying/comments/vv6g4g/i_dont_know_why_but_this_image_is_so_pleasing/) - Cranberry tart via [Reddit](https://www.reddit.com/r/oddlysatisfying/comments/tvdddr/this_cranberry_tart/?utm_term=1806211071&utm_medium=post_embed&utm_source=embed&utm_name=&utm_content=header) - Truck illustration, MnDOT vehicle classification scheme. Available [here](https://www.dot.state.mn.us/traffic/data/reports/vc/Vehicle_Classification_Scheme.pdf) - Rainbow illustration: Oren neu dag, [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0), via Wikimedia Commons - Emoji images (Microsoft version) via [Emojipedia](https://emojipedia.org/)