
Andy
Lyons
March 26, 2026


Precision Irrigation Calculator
https://ucanr-igis.shinyapps.io/irrigation-calc/
Pistachio Nut Growth Calculator
https://ucanr-igis.shinyapps.io/pist_gdd/
Tree Chill Calculator for Cherry
https://ucanr-igis.shinyapps.io/cherrychill/
Navel Orangeworm IPM Economics Calculator
https://ucanr-igis.shinyapps.io/now_ipm_econ/
Chill Portions Under Climate Change Calculator
https://ucanr-igis.shinyapps.io/chill/
Why is R So Popular?
It’s free!
Huge user community (especially academics)
Thousands of add-ons (packages) that extend its capabilities
Particularly strong in plotting and reporting
Once you get over the initial hump, can work very efficiently
Makes it easy to get your code “out there”
Solid overall programming language



Exercise 1 Topics
Posit Cloud project for this workshop:
After it opens:

Key vocabulary terms are in italic.
When you enter an expression at the console, R will evaluate the expression, and print the results at the console.
If you enter an incomplete expression, R will prompt you to finish the job by showing a ‘+’ symbol in the console
You can save the results of an expression to an
object (variable) using an assignment operator
=
<-
R objects can be named almost anything (but no spaces or hyphens please)
R is case sensitive about everything
Once defined, R objects can be used in subsequent expressions
R objects can be updated (assigned a new value)
R objects are only saved in memory, and will disappear when you close RStudio
R has a few built-in constants, which are like objects but you don’t have to define them
Agroclimate metrics reflect weather driven factors that influence the development of plants and insects.
Examples:
These are abiotic factors but they influence biotic factors that affect crops (like disease).
The main ingredients of metrics are measurements of weather variables (like air temperature).
We can compute them for the past, present, and future.


Pistachio nut embryo length vs
degree days
Zhang et al (2021)


![]() https://doi.org/10.1016/j.ufug.2018.07.020 |
Where can I go today to see the climate my city will have 50 years from now? |
| How many generations of Navel Orangeworm will growers have to deal with in the coming decades? |
![]() https://doi.org/10.1016/j.scitotenv.2020.142657 |
![]() https://doi.org/doi:10.1371/journal.pone.0020155 |
How much chill can we expect in the coming decades? Will there be enough to have a economically viable farming operation? |
| What kind of frost exposure will we see mid-century? |
![]() https://doi.org/10.1016/j.scitotenv.2020.143971 |
![]() https://doi.org/10.3390/agronomy12010205 |
What is the ‘new normal’ for agroclimatic metrics for specialty crops? |
R is an extremely flexible computing environment,
with
strengths in:


owmr:
OpenWeatherMap API Wrapper
rnoaa: ‘NOAA’
Weather Data from R
riem: Accesses
Weather Data from the Iowa Environment Mesonet
…plus many
others
Or write your own!


File server

API service


Packages are what R calls extensions or add-ons.
The keys to R’s superpowers are functions! There are four things you need to know to use a function:
|
Finding the right R function, half the battle is. - Jedi MasteR Yoda |
|
Ask your friends
Ask Google
Cheatsheets!

Piping syntax is an alternative way of writing arguments into functions.
With piping, you use the pipe operator |> (or %>%) to ‘feed’ the result of one function into the next function.
Piping allows the results of one function to be passed as the first argument of the next function. Hence a series of commands to be written like a sentence.
Consider the expression:
zoo(moo(boo(foo(99)),n=4))

R has two data classes that organize data in rows and columns:
Whatever is needed to get your data frame ready
for the function(s) you want to use for analysis and visualization.

also called data munging, manipulation, transformation, etc.
Often includes one or more of:
Data wrangling is a pain!
But R (specifically the tidyverse packages) makes it (a lot) easier.
dplyrAn alternative (usually better) way to wrangle data frames than base R.
Part of the tidyverse.
Best way to familiarize yourself - explore the cheat sheet:
dplyr Functions| subset rows | filter(), slice() |
| order rows | arrange() |
| pick column(s) | select(), pull() |
| add new columns | mutate() |
Most dplyr functions take a tibble as the first
argument , and return a tibble.
This makes them very pipe friendly.
Theoretical example:


Exercise 2 Topics
Top five advantages of using scripts over the console:
