How to understand R code written by someone else (CC131)
You are likely to find code out on the internet that is written by someone else that you need to understand. Sometimes that code was written by someone else in your lab. And sometimes... it was written by you six months ago! But now the problem is trying to figure out (or remember!) what it does. In this Code Club, Pat takes some code that has been floating around the lab for comparing distributions of AUC values for different machine learning models. What does this line do? What is that function? What is even going on here? Tune in see what Pat finds!
In this episode, Pat will use functions from the #mikropml R package and data handling functions from #dplyr in #RStudio. The accompanying blog post can be found at https://www.riffomonas.org/code_club/2021-07-26-understanding-code.
If you're interested in taking an upcoming 3 day R workshop, email me at
[email protected]!
R: https://r-project.org
RStudio: https://rstudio.com
Raw data: https://github.com/riffomonas/raw_data/releases/latest
Workshops: https://www.mothur.org/wiki/workshops
You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/
0:00 Introduction
2:59 Tracking down code to compare AUC values
9:53 Strategy 1: Reading code for general understanding
12:04 Strategy 2: Run code with example data
12:56 Strategy 3: Walk example data through each line of code
22:03 Strategy 4: Refactor code into your own words
31:22 Strategy 5: Apply refactored code to my problem
34:12 Recap