- Solve complex problems by creating tiny problems
- Apply unit testing principles to verify your solution
Problem Solving
EDS 214: Analytical Workflows and Scientific Reproducibility
Day 3 Morning | August 27th, 2025
This morning, you’ll learn how to…
So Far…
Schaefer et al. (2000) use a moving average
The data have non-uniform intervals
There are thousands of rows
Problem Solving Approach
Instructions
eds-214-workflows-reproducibility/problem-solving (I’ll show you how)Tiny Example
Create a tiny example in the workbook (link in script)
Shape your example like a data frame
Ask yourselves:
Solve by Hand
In your same groups:
Add a column to your tiny example
Solve the problem by hand in the new column
Double-check your work
Minimum Information
As a group, make a list of the variables you need to solve the problem once
Put the Solution in a Function
One (and only one) member of your group opens RStudio
Create a new script
Write the function
Verify Your Solution
(If necessary) Install googlesheets4 package
sheet_url <- "https://docs.google.com/spreadsheets/d/1X-SltNKUaZH0zVWSUkC8sUrrlhPEPAd-6tBmbcihCSw"
tiny_problem <- googlesheets4::read_sheet(sheet_url, sheet = "Example")
Call your function on one case in the tiny example
Do not debug yet!
Apply Your Function
apply(), sapply(), mutate(), for()…REPEAT UNTIL SOLVED
Problem Solving Recap