EDS 221: Scientific programming essentials

Programming essentials for environmental data science

Honeycomb hex patterns. Photo by Shilo Labelle on Unsplash.

Instructor

Allison Horst (ahorst@ucsb.edu)

Teaching Assistant

Yutian Fang (yutianfang@umail.ucsb.edu)

Course description

In EDS 221, students will build key scientific programming skills essential for environmental data analysis and problem solving in R. Topics include structured programming and algorithm development, iteration, conditionals, functions and objects, documentation, testing and troubleshooting, tidy data structure, and an introduction to data wrangling and visualization.

Learning objectives

By the end of EDS 221, students should be able to:

Predictable daily schedule

Course dates: Monday (2023-08-14) - Friday (2023-08-18)

EDS 221 is an intensive 2-week long 4-unit course. Students should plan to attend all scheduled sessions. All course requirements will be completed between 10am and 4:30pm PST (M - F), i.e. you are not expected to do additional work for EDS 221 outside of those hours, unless you are working with the Teaching Assistant in student hours.

Tentative daily schedule (subject to change):

Time (PST) Activity
10:00am - 11:00am Lecture 1
11:15am - 12:30pm Interactive Session 1
12:30pm - 1:30pm Lunch
1:30pm - 2:15pm Lecture 2
2:15pm - 3:00pm Interactive Session 2
3:00pm - 4:30pm Activities

Expected sessions (subject to change)

Note: lectures and flex sessions will also often include interactive live-coding. You should bring your computer and charger to all sessions in EDS 221.

Day / session Lecture Interactive sessions Activities
Monday 8/14: morning
  1. “Hello, world”: course introduction, programming in EDS, meet our tools
Don’t fear the Terminal - continuing with some commands, navigation, and more git N/A
Monday 8/14: afternoon
  1. Project oriented workflows, file paths, naming things,good habits from the tidyverse style guide
Meet here , project organization, adding data import to our workflow Day 1 Activities - Handout
Tuesday 8/15: morning
  1. Data representation and types
Creating and indexing with different data types N/A
Tuesday 8/15: afternoon
  1. Common data types and structures in EDS
Data in R, accessing / updating elements & casting continued Day 2 Activities - Handout
Wednesday 8/16: morning
  1. Conditionals and logical operations, intro to for loops
Refresh logical operations, write basic for loops in R N/A
Wednesday 8/16: afternoon
  1. Loops continued - and functions to help
For loops with conditions, apply() functions, and across()

Day 3 Activities - Handout
Thursday 8/17: morning
  1. Introduction to writing functions in R and Python
Functions 101: basics N/A
Thursday 8/17: afternoon
  1. Functions continued: planning, adding useful messages, more advanced functions and outputs
Functions 102: beyond basics (functions with conditions, iteration, messages) Day 4 Activities - Handout
Friday 8/18: morning
  1. Functions continued: testing, documentation, sharing
Functions 103: testing & documenting functions, making your first package N/A
Friday 8/18: afternoon
  1. Finding & using external packages
Find & explore packages, documentation, accessing from repos Day 5 Activities - Handout
Monday 8/21: morning
  1. Tidy data: what, why, how?
Tidying data (pivot, separate) basics with tidyr and pandas N/A
Monday 8/21: afternoon
  1. Data tidying and wrangling continued: dplyr and pandas
Data wrangling continued - dplyr and pandas Day 6 Activities - Handout
Tuesday 8/22: morning
  1. Data wrangling continued - more tidying, relational data & types of joins
Data wrangling continued: joins N/A
Tuesday 8/22: afternoon
  1. Data wrangling continued - working with dates & times, wrangling strings
Data wrangling continued: dates, times, strings Day 7 Activities - Handout
Wednesday 8/23: morning (late start)
  1. The grammar of graphics & basic graph considerations

Fork this repo to follow along with Data visualization in ggplot2

See also: Ced Scherer’s ggplot2 tutorial, and Yan Holtz’ From Data to Vis and R Graph Gallery

N/A
Wednesday 8/23: afternoon
  1. Data visualization basics - responsible, clear, awesome
Data viz continued Day 8 Activities - Handout
Thursday 8/24: morning
  1. Troubleshooting 101
Teach Me How to Google Workshop (Sam Csik) N/A
Thursday 8/24: afternoon
  1. kable tables, and alt-text
More wrangling tools and practice, kable tables Day 9 Activities - Handout
Friday 8/25: morning R package revisited, tables in R, a taste of git collaboration .N/A Morning activity - handout
Friday 8/25: afternoon Course wrap-up N/A Afternoon Activity - handout

Course requirements

Computing

About this website

This website was created with gratitude using distill from RStudio by JJ Allaire, Rich Iannone, Alison Presmanes Hill, and Yihui Xie.

This website is one piece of the EDS 221 course materials in addition to lectures, computational activities, discussions, and individual and group tasks, and important materials may exist partially or not at all on this site. While this website is public, it is not meant as a standalone online course.

Other packages used to create this website: