Introduction to R Training - July 2024
1 Intro to R for DWR
Welcome to the Intro to R class for the Department of Water Resources, 2024!
For the first time, this is not taught by outside consultants, but by your own colleagues here at the department.
1.1 Ground rules
Please participate fully in the class. You will get out of this class exactly as much as you put into it. This means not multi-tasking, completing the exercises, and asking questions when you get stuck.
Please come prepared. Install software ahead of time, have the link to this book on-hand, and review materials from the previous day before the next day’s class.
Don’t be afraid to ask questions! Any coding language can be frustrating, so please speak up if you are having trouble. One of our teaching assistants can work with you 1:1 for major problems.
1.2 Before you come to class
Install R
Go to the Comprehensive R Archive Network (CRAN) webpage and download R for Windows.
Open the installer and follow the prompts to install R on your computer using the default settings. You may need an administrator account to complete this step.
If you already have R on your computer, please make sure it is version 4.0 or above. (The latest version is 4.4.1)
See full instructions here: https://rstudio-education.github.io/hopr/starting.html
Install R Studio
Go to the Download Rstudio page on the Posit website and download R Studio for Windows.
Open the installer and follow the prompts to install R on your computer using the default settings. You may need an administrator account to complete this step.
Open RStudio and make sure it runs.
- The window titled “Console” should come up and have the R version and some boilerplate information about R in it, with a blue carrot and cursor below it.
Install the
tidyverse
andhere
packages- In your console, type
install.packages("tidyverse", "here")
- The package should download and install automatically. You do not need administrative privileges for this step.
- NOTE: There are sometimes issues accessing CRAN from within RStudio while connected to a DWR network. If you receive this message, use your home wifi or a cell phone hot spot to connect to the internet, then try again.
- In your console, type
1.3 Meet your instructors
Rosemary Hartman (She/Her) is an Environmental Program Manager in the Division of Integrated Science and Engineering. She is an aquatic ecologist by training, with an emphasis on data synthesis, statistics, and data integration. She would love to tell you how to analyze your data.
Perry (They/Them) is an Environmental Scientist with the Environmental Monitoring Program who is also getting a master’s degree in statistics from UC Davis. They are fluent in both Python and R.
Nick Rasmussen (He/Him) is a Senior Environmental Scientist with broad interests in aquatic ecology who has worked on projects ranging from the Salinity Control Gates to aquatic weeds.
Dave Bosworth (He/Him) is a Senior Environmental Scientist who comes from a water quality and contaminants background but has found his calling as a data scientist. He is passionate about making your code more efficient and automating all the boring stuff.
Ted Swift (He/Him) is a Senior Environmental Scientist with the Quality Management Section who is working to increase the number of data science training available to DWR scientists.