Bren School of Environmental Science and Management (UC Santa Barbara)

**Course description:** Develop critical thinking, technical and communication skills to successfully approach and answer environmental questions using quantitative and qualitative data. Topics include: data wrangling using the tidyverse and tidy data principles, exploratory data analysis and visualization, descriptive statistics, uncertainty, hypothesis testing, data visualization and communication. Best practices for reproducibility, version control and collaboration are emphasized throughout. Skills will be developed through wrangling, analysis and communication of datasets using R, RStudio and GitHub.

**Course goals:**

- Intro to R/RStudio
- Data wrangling with the tidyverse
- Data visualization with ggplot2
- Exploratory data analysis
- Summary statistics and hypothesis testing
- Regression (linear, logistic)
- Reproducible workflows for collaborative data science

**ESM 206 course syllabus (Fall 2019)**

**Course resources:**

- R for Data Science (Grolemund & Wickham)
- R Cookbook, 2nd Ed. (Long & Teeter)
- Fundamentals of Data Visualization by Claus Wilke
- Ocean Health Index Open Data Science Training
- Happy Git with R by Jenny Bryan
- In progress: Allison's "ten-examples-each" of common tidyverse functions

**ESM 206 ARCHIVES**

**ESM 244 course description:** A survey course in advanced topics in statistics and data analysis for environmental scientists (ordinal and multinomial logistic regression, bootstrapping, non-linear models, intro to time-series analysis, spatial data analysis and interpolation, ordination methods, cluster analysis, text mining, etc.) while continuing to build skills and habits in data science (data wrangling, analysis & computational reproducibility in R/RStudio, version control and collaboration with R and GitHub). Term project: build a Shiny app.

**ESM 244 course syllabus (Winter 2019)**

- Slide deck (all sessions)
- Handout
- Recommended resources:
- Fundamentals of Data Visualization by Claus O. Wilke
- From Data-to-Viz
- Storytelling with data
**Day 1:**Algebra review, slope, derivatives intro**Day 2:**Derivatives continued, rules, applications, thinking about differential equations**Day 3:**Logs & exponents, integration introduction**Day 4:**Integration continued - particular solutions, definite integrals, applications- Day 4 slides
*No practice problems today, enjoy your weekend!***Day 5:**Trig review, partial derivatives, multiple integrals**Day 6:**Dimensional analysis, significant figures, orders of magnitude, unit conversion, log transform**Day 7:**Basic probability theory, Bayes' theorem, probability density**Workshop cheatsheet****Day 1:**Algebra warm-up, derivatives review (Day 1 slides)**Day 2:**Partials, integration (basic concepts), calculus applications, probability density (Day 2 slides)**Day 3:**Hypothesis testing bonanza, p-value cautions, regression recap (Day 3 slides)**Day 4 Part 1:**Regression continued, reproducibility in research, data science workflows (Day 4 slides)**Day 4 Part 2:**R/RStudio intro - .Rproj, importing data, basic wrangling with dplyr, pipe operator- Packages required: tidyverse
- Download Day 4 Part 2 materials
**Day 5:**Rmarkdown, wrangling with the tidyverse continued, dataviz with ggplot2- R packages required: tidyverse
- Download Day 5 materials
**Day 6:**Wrangling & viz continued, hypothesis tests, regression- Packages required: tidyverse, janitor, RColorBrewer, ggbeeswarm, stargazer
- Download Day 6 materials
**Day 7:**Wrangling, mlr, intro to spatial data wrangling & vizualization- Packages required: tidyverse, *tidyr, janitor, corrplot, sf, stargazer, **tmap
- *You need to install the recent release of tidyr from CRAN (just run
`install.packages("tidyr")`

in the Console) to use the updated pivot_longer() and pivot_wider functions - **Get the
**development version**of the`tmap`

package by: (1) install`devtools`

package (`install.packages("devtools")`

), (2) attach devtools by running`library(devtools)`

in the console, (3) run the following to install development version of tmap:`install_github('mtennekes/tmap')`

, (4) check to see if you can attach tmap in the console with`library(tmap)`

. Yes? Great! You have the development version of tmap. - Download Day 7 materials
**Session 1: R/RStudio review, intro to data wrangling & viz with tidyverse functions**- Packages needed: tidyverse, janitor, ggrepel
- Download Session 1 materials (data, instructor key, etc.)
- Watch the Session 1 recording
**Session 2: RMarkdown intro, wrangling & viz continued**- Packages needed: tidyverse, janitor
- Download Session 2 materials
- Watch the Session 2 recording - (screen share starts at 2:10...oops)
**Session 3: Intro to spatial data import, wrangling and viz with sf, ggplot2, and tmap**- Packages needed: tidyverse, sf, tmap (dev version)
- Download Session 3 materials
- Watch the Session 3 recording
**Session 4: Intro to Shiny apps**- Packages needed: tidyverse, shiny, shinydashboard
- Watch the Session 4 recording
- Download Session 4 materials:

- ESM 206: Introductory data analysis and statistics in environmental science and management (2012 - present)
- ESM 244: Advanced methods in environmental data science (2012 - present)
- ESM 438: Presentation skills for environmental professionals (2013 - present)
- Calculus intensive workshop: a 2-week calculus refresher course for incoming graduate students at the Bren School (2008 - present)
- Data analysis workshop: a 2-week quantitative methods and introduction to R workshop for incoming PhD students at UCSB (2016 - present)

- Bren School Distinguished Teaching Award (2018)
- UC Santa Barbara Distinguished Teaching Award (2019)