NMFS Openscapes Wiki NMFS R User Group


The July 29 session of the R Workflow Workshops is post-poned to August 5th due to technical difficulties with our WebEx.

Starting May 20th, 2022. These short sessions (45min to 1hr) will be focused on R, RStudio and GitHub tools and practices for NOAA scientists to help you be faster, more efficient and organized. The focus of these workshops is practical skills and tools; they are intended to get you applying the skill immediately in your own work. I will give you links to my and other NOAA GitHub repositories that illustrate more complex examples (that you can copy and build on).

Target audience: Note only weeks 5-6 assume you program in R. Weeks 1-4: Beginner practical intro to Git and GitHub. This year, I also have two sessions on Agile project management and Scrum using GitHub issues and project boards. Weeks 5-6: You already code in R and want to learn how to make an R package so you can share your code with colleagues better. Weeks 7-8: R Markdown. I’ll use examples with R but really this is about the RStudio and GitHub tools for making documents and pages.

About the instructor Eli Holmes: I am a modeler/applied mathematician. I develop R packages for public use. I teach time-series analysis at the University of Washington (using R) and I teach workshops on R and reproducible research and am heavily involved in efforts to support transition to Open Science workflows within NOAA Fisheries. website

Set-up for the workshop

For weeks 1-4, you’ll need a GitHub account and GitHub Desktop installed. For weeks 5-6, you’ll want R and RStudio installed on your computer or you can use RStudio Cloud. If you do the latter, you don’t need to install any software.

topic
May 20 Git/GitHub, part 1 lecturevideo
May 27 Git/GitHub, part 2 lecturevideo
June 3 Agile part 1, Kanban lecturevideo
June 10 Agile part 2, Scrum lecturevideo
July 8 R packages, part 1 lecturevideo
July 15 R packages, part 2 lecturevideo
July 22 R markdown reports, part 1 lecturevideo
Aug 5 R markdown reports, part 2 lecturevideo

—-

2022 Topics Fridays 10-11am PDT

Part 1

  • May 20 Introduction to Git/GitHub I will introduce you to Git and GitHub for tracking your work. In this session, you will learn the 3 basic Git skills that are all you need to get started (and for many scientists are all they need). I worked for years with just these 3 skills. Skill 1: Clone one of your GitHub repos onto your computer, Skill 2: Commit local changes, and Skill 3: Push/Pull changes to/from GitHub. I’ll discuss how to deal with merge conflicts, which often cause beginners a lot of heartburn. Lecture notes - Lecture video - Q&A

  • May 27 More Git skills + GitHub issues, organizations, and releases This week, I’ll cover the basics of reverting changes and using Git branches. Then we’ll learn about key GitHub tools for managing your work and collaborating: issues, discussion threads, wikis, organizations and releases. These features are key to helping you organize your work and keep track of what needs to be done. These features also allow a team to collaborate effectively together on a repository. Next week, we’ll start learning about GitHub project boards. Lecture notes - Lecture video - Q&A

  • June 3 Introduction to Agile project management Now that you have learned about Git and GitHub project tracking features, we will learn the basics of Agile project management and how you can use GitHub tools to help implement that. Agile project management focuses how to structure team communication and workflow to facilitate peer collaboration and help, get quick feedback from end-users, allow responsiveness to change, and focus on the key tasks. This week, I’ll show you how to use Kanban, an Agile methodology, with GitHub Project Boards with and without automation. Lecture notes - Slides - Lecture video - Q&A

  • June 10 Intro to Scrum using GitHub issues and project boards This week will focus on the most popular Agile methodology: Scrum. Although Scrum is associated with software development, it is used in many different fields. Scrum is a lightweight and flexible framework that helps teams to work together better and learn with each cycle of work. It has 3 roles, 5 events (steps) that the team goes through during a time-boxed period of work. I will show you how to set up and run a Scrum Sprint in GitHub. The real power of Scrum comes with teams by promoting high functioning teamwork, but you can use Scrum solo; you’ll just have to ‘switch hats’ when you take on different roles. Slides - Lecture video - Q&A

Part 2

  • July 8 Intro to creating R packages This week I will show you how to make an R package for code or data. RStudio makes this incredibly easy; literally 2-3 clicks. R packages are not just for work that you share with others. Most of my code projects are organized into an R package and definitely any project that I have that involves data and code is organized into an R package. The package framework helps you write robust and well documented code. It also makes it easy to bundle data with code. By the end of this session, you will be able to build your own mini R package. Lecture notes - Lecture video - Q&A

  • July 15 Beyond the basics with R packages This lecture will take you past the basics. In the first half, we’ll dive a bit deeper into {roxygen2} documentation. Gone are the days when you need to write documentation manuals. Roxygen automatically assembled your headers into documentation (help files, manuals, etc). Once your package is documented with Roxygen, creating a website is simple with pkgdown. In the second half, I give you a brief overview of the very handy {usethis} package. We’ll put our package on GitHub so others can install it. I briefly show you how we use GitHub Actions for automated pkgdown updating when we change our package files. Lecture notes - Lecture video - Q&A

  • July 22 R Markdown for reports Part 1: integrating text and data tables There are many online tutorials for R Markdown which will cover the basics. I will focus on R Markdown for fisheries (or other) reports. When the data change (which happens often), we have to remake tables (and graphs) and update the numbers in text. For big reports, this is time-consuming and creates errors. In this 2 part series, I’ll show you how to use R Markdown to automate this process, so you are not manually remaking reports. Lecture notes - Lecture video - Q&A

  • Aug 5 R Markdown for reports Part 2: creating a report Part 1, introduced you to some of the elements of R Markdown used in a report. In part 2, we’ll put these elements together to create a report. You’ll also learn how to use Word templates to give your report the right “look”, i.e. like an official report not a generic R Markdown document. I’ll give a tour of a variety of fisheries reports using R Markdown for inspiration; along with their GitHub repositories. I’ll also give a brief intro to GitHub Actions which are used to automate rebuilding of online reports. Lecture notes - Lecture video - Q&A

  • Video only Writing tests for R packages and other code Writing tests and automating quality control for your R packages and code: we know we should do it, but for most of us, it is the last thing we do or want to do. In this session, I’ll get you started writing unit tests using the {testthat} package (the standard). I’ll also give examples of the other types of common tests and some ideas of how to automate these tests with GitHub Actions. The goal is to give you some easy coding habits that will help you incorporate tests without too much extra work.


NWFSC Math Bio Program, NOAA Fisheries