-
Notifications
You must be signed in to change notification settings - Fork 0
/
irrigation-trends.Rmd
466 lines (382 loc) · 29.6 KB
/
irrigation-trends.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
---
title: "irrigation-productivity-trends"
author: "Britta Schumacher"
date: "Last updated: `r format(Sys.time(), '%d %B, %Y')`"
output:
html_document:
theme: flatly
toc: yes
toc_float: true
code_folding: hide
---
Bring in packages & data built in step 11, build-panels-for-analysis.Rmd
```{r message = F, warning = F}
library(tidyverse)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
library(gridExtra)
library(ggpubr)
library(knitr)
```
# Trends
**DATA**: sumstat_indyrs.RDS and western_ctys.RDS
Let's show trends in Estimated Average Yield, Water Use, and Irrigation Productivity over time. These trends are built from the sum_stat_indyrs_X.RDS datasets and are built as line graphs, facetted by state. I am STILL using the same *key variables* (yield, water use).
1) Pull in datasets (again!) selecting only those county-year-crop combinations that show up across all four FRIS years. We will then merge these datasets (have only GEOID as a county identifier) with a distinct() version of the FRIS (has COUNTY_ALPHA, STATE_ABBR). This ensures that we have a "County, State Abbreviation" column to use in our visualizations, below.;
2) I then build two functions for irrigation productivity. I had to do this because my functions were failing to accept new parameters. The first function builds out a line graph by crop-county-year by state for each metric; the third function builds out by crop-county-year but not by state. I use the third and fourth function to build line graphs for crops that have too few observations to warrant visualization by state.;
These functions take the arguments:
function(data_frame, "CROP", "STATE AABREVIATION", "TITLE--always blank", "Y Axis Label", "./file_path/file_name.png")
Visualizations are sent to crop-specific folders within variable specific trend folders and are built for both metric and US (same graph, different scale) measurements.
Below is a whole lot of code, but its all doing the same exact action on different datasets and different variables and spitting out the results into nested crop-specific and variable-specific folders! Everything below works on estimated average, summarised data--NO raw data is visualized. We are trying to get a sense here of how these different variables change and vary spatially and temporally.
```{r}
# Build line graph over time using the _indyrs datasets (to show trends over time)
library(RColorBrewer)
fris_sp_indyrs <- readRDS("./data/sumstat_indyrs.RDS")
# find counties in both datasets that have data across all four years of the fris for different crops
trends_fris <- fris_sp_indyrs %>%
mutate(count = 1) %>%
group_by(GEOID, CROP) %>%
summarise(count_yrs = sum(count)) %>%
filter(count_yrs == 4)
# We will use the above as a key to pull data from fris_sp_indyrs and fris5_sp_indyrs, keeping only those county-crop combinations where there are observations in all four years
trends_fris <- merge(trends_fris, fris_sp_indyrs, by = c("GEOID", "CROP"))
# the dataframes above have only county-crop combinations where there is an observation in each year.
# let's merge them with our full-panel-FRIS.RDS to build in a county name identifier
cty_names <- readRDS("./data/cty_names.RDS")
ctys <- readRDS("./data/western_ctys.RDS")
ctys_df <- as.data.frame(ctys)
ctys_df <- merge(cty_names, ctys_df)
fris_names <- ctys_df %>%
select(GEOID, COUNTY_ALPHA, STATE_ABBR) %>%
distinct()
fris_names <- transform(fris_names, County = paste(COUNTY_ALPHA, STATE_ABBR, sep= ", "))
trends_fris <- merge(trends_fris, fris_names, by = "GEOID")
# build line graph by crop-county BY STATE
build_trends <- function(df, crop, abbr, var, ylab) {
x <- df %>%
filter(CROP == crop) %>%
filter(STATE_ABBR == abbr)
var <- enquo(var)
crop_trends <- ggplot(x, aes(x = YEAR, y = !! var)) +
geom_point(size = 3, aes(color = County)) +
geom_line(aes(color = County)) +
scale_color_brewer(palette = "Paired") +
#guides(col=guide_legend(ncol=2)) +
xlab("Year") +
ylab(ylab) +
scale_x_continuous(breaks = seq(2003, 2018, by = 5)) +
theme_classic()
#ggsave(place, width=6, height=4,dpi=300, units="in", device='png')
return(crop_trends)
}
# build line graph by crop-county BY STATE (NO PALLETE + 2 column legend)
build_trendsa <- function(df, crop, abbr, var, ylab) {
x <- df %>%
filter(CROP == crop) %>%
filter(STATE_ABBR == abbr)
var <- enquo(var)
crop_trends <- ggplot(x, aes(x = YEAR, y = !! var)) +
geom_point(size = 3, aes(color = County)) +
geom_line(aes(color = County)) +
#scale_color_brewer(palette = "Paired") +
guides(col=guide_legend(ncol=2)) +
xlab("Year") +
ylab(ylab) +
scale_x_continuous(breaks = seq(2003, 2018, by = 5)) +
theme_classic()
#ggsave(place, width=6, height=4,dpi=300, units="in", device='png')
return(crop_trends)
}
```
# Irrigation - metric (kilograms/cubic meter)
```{r}
######## ALFALFA
build_trends(trends_fris, "ALFALFA", "AZ", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "ALFALFA", "CA", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "ALFALFA", "CO",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trendsa(trends_fris, "ALFALFA", "ID",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "MT",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "ALFALFA", "NV",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "ALFALFA", "NM",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "ALFALFA", "OR",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trendsa(trends_fris, "ALFALFA", "UT",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "WA",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
######## HAY
build_trends(trends_fris, "OTHER_HAY", "AZ", EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "CA", EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "CO", EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "MT", EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "NV", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "OR", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "UT", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "OTHER_HAY", "WA", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
##### WHEAT
build_trends(trends_fris, "WHEAT", "AZ",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "WHEAT", "CA",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "WHEAT", "CO",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "WHEAT", "ID",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "WHEAT", "OR",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "WHEAT", "UT",EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "WHEAT", "WA",EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
##### Corn Grain
build_trends(trends_fris, "CORN_GRAIN", "CA", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_GRAIN", "CO", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_GRAIN", "ID", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_GRAIN", "OR", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_GRAIN", "WA", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
##### Corn Silage
build_trends(trends_fris, "CORN_SILAGE", "AZ", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "CA", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "CO", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "ID", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "NM", EST_IP_KG_M,"Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "OR", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "UT", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
build_trends(trends_fris, "CORN_SILAGE", "WA", EST_IP_KG_M, "Irrigation Productivity (kilograms/cubic meter)")
```
# Irrigation productivity - US (pounds/acre foot)
```{r}
####################################################################################################################
####### Irrigation Productivity (US)
####################################################################################################################
######## ALFALFA
build_trends(trends_fris, "ALFALFA", "AZ", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "ALFALFA", "CA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "ALFALFA", "CO", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trendsa(trends_fris, "ALFALFA", "ID", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "MT", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "ALFALFA", "NV", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "ALFALFA", "NM", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "ALFALFA", "OR", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trendsa(trends_fris, "ALFALFA", "UT", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "WA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
######## HAY
build_trends(trends_fris, "OTHER_HAY", "AZ", EST_IP_LBS_AF,"Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "CA", EST_IP_LBS_AF,"Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "CO", EST_IP_LBS_AF,"Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "MT", EST_IP_LBS_AF,"Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "NV", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "OR", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "UT", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "OTHER_HAY", "WA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
##### WHEAT
build_trends(trends_fris, "WHEAT", "AZ",EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "WHEAT", "CA",EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "WHEAT", "CO",EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "WHEAT", "ID",EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "WHEAT", "OR",EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "WHEAT", "UT",EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "WHEAT", "WA",EST_IP_LBS_AF,"Irrigation Productivity (pounds/acre foot)")
##### Corn Grain
build_trends(trends_fris, "CORN_GRAIN", "CA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_GRAIN", "CO", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_GRAIN", "ID", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_GRAIN", "OR", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_GRAIN", "WA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
##### Corn Silage
build_trends(trends_fris, "CORN_SILAGE", "AZ", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "CA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "CO", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "ID", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "NM", EST_IP_LBS_AF,"Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "OR", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "UT", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
build_trends(trends_fris, "CORN_SILAGE", "WA", EST_IP_LBS_AF, "Irrigation Productivity (pounds/acre foot)")
```
# Yield - metric (kilograms/hectare)
```{r}
####################################################################################################################
####### ESTIMATED AVERAGE YIELD (Metric)
####################################################################################################################
######## ALFALFA
build_trends(trends_fris, "ALFALFA", "AZ", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "ALFALFA", "CA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "ALFALFA", "CO", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trendsa(trends_fris, "ALFALFA", "ID", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "MT", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "ALFALFA", "NV", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "ALFALFA", "NM", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "ALFALFA", "OR", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trendsa(trends_fris, "ALFALFA", "UT", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "WA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
######## HAY
build_trends(trends_fris, "OTHER_HAY", "AZ", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "CA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "CO", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "MT", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "NV", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "OR", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "UT", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "OTHER_HAY", "WA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
##### WHEAT
build_trends(trends_fris, "WHEAT", "AZ", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "WHEAT", "CA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "WHEAT", "CO", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "WHEAT", "ID", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "WHEAT", "OR", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "WHEAT", "UT", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "WHEAT", "WA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
##### Corn Grain
build_trends(trends_fris, "CORN_GRAIN", "CA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "CO", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "ID", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "OR", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "WA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
##### Corn Silage
build_trends(trends_fris, "CORN_SILAGE", "AZ", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "CA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "CO", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "ID", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "NM", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "OR", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "UT", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "WA", EST_AVE_YIELD_KG, "Yield (kilograms/hectare)")
```
# Yield - US (pounds/acre)
```{r}
####################################################################################################################
####### Estimated Average Yield (US)
####################################################################################################################
######## ALFALFA
build_trends(trends_fris, "ALFALFA", "AZ", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "ALFALFA", "CA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "ALFALFA", "CO", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trendsa(trends_fris, "ALFALFA", "ID", EST_AVE_YIELD_LBS, "Yield (pounds/acre)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "MT", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "ALFALFA", "NV", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "ALFALFA", "NM", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "ALFALFA", "OR", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trendsa(trends_fris, "ALFALFA", "UT", EST_AVE_YIELD_LBS, "Yield (pounds/acre)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "WA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
######## HAY
build_trends(trends_fris, "OTHER_HAY", "AZ", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "CA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "CO", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "MT", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "NV", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "OR", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "UT", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "OTHER_HAY", "WA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
##### WHEAT
build_trends(trends_fris, "WHEAT", "AZ", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "WHEAT", "CA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "WHEAT", "CO", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "WHEAT", "ID", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "WHEAT", "OR", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "WHEAT", "UT", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "WHEAT", "WA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
##### Corn Grain
build_trends(trends_fris, "CORN_GRAIN", "CA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_GRAIN", "CO", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_GRAIN", "ID", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_GRAIN", "OR", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_GRAIN", "WA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
##### Corn Silage
build_trends(trends_fris, "CORN_SILAGE", "AZ", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "CA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "CO", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "ID", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "NM", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "OR", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "UT", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
build_trends(trends_fris, "CORN_SILAGE", "WA", EST_AVE_YIELD_LBS, "Yield (pounds/acre)")
```
# Water use - metric (cubic meters/hectare)
```{r}
####################################################################################################################
####### ESTIMATED AVERAGE WATER USE (Metric)
####################################################################################################################
######## ALFALFA
build_trends(trends_fris, "ALFALFA", "AZ", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "ALFALFA", "CA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "ALFALFA", "CO", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trendsa(trends_fris, "ALFALFA", "ID", EST_AVE_WU_M, "Water Application (cubic meters/hectare)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "MT", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "ALFALFA", "NV", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "ALFALFA", "NM", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "ALFALFA", "OR", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trendsa(trends_fris, "ALFALFA", "UT", EST_AVE_WU_M, "Water Application (cubic meters/hectare)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "WA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
######## HAY
build_trends(trends_fris, "OTHER_HAY", "AZ", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "CA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "CO", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "MT", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "NV", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "OR", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "UT", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "OTHER_HAY", "WA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
##### WHEAT
build_trends(trends_fris, "WHEAT", "AZ", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "WHEAT", "CA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "WHEAT", "CO", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "WHEAT", "ID", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "WHEAT", "OR", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "WHEAT", "UT", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "WHEAT", "WA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
##### Corn Grain
build_trends(trends_fris, "CORN_GRAIN", "CA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "CO", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "ID", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "OR", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_GRAIN", "WA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
##### Corn Silage
build_trends(trends_fris, "CORN_SILAGE", "AZ", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "CA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "CO", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "ID", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "NM", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "OR", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "UT", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
build_trends(trends_fris, "CORN_SILAGE", "WA", EST_AVE_WU_M, "Water Application (cubic meters/hectare)")
```
# Water use - US (acre feet/acre)
```{r}
####################################################################################################################
####### Estimated Average Water Use (AF)
####################################################################################################################
######## ALFALFA
build_trends(trends_fris, "ALFALFA", "AZ", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "ALFALFA", "CA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "ALFALFA", "CO", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trendsa(trends_fris, "ALFALFA", "ID", EST_AVE_WU_AF, "Water Application (acre feet/acre)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "MT", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "ALFALFA", "NV", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "ALFALFA", "NM", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "ALFALFA", "OR", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trendsa(trends_fris, "ALFALFA", "UT", EST_AVE_WU_AF, "Water Application (acre feet/acre)") ## too many counties for palette, use alternate function
build_trends(trends_fris, "ALFALFA", "WA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
######## HAY
build_trends(trends_fris, "OTHER_HAY", "AZ", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "CA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "CO", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "MT", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "NV", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "NM", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "OR", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "UT", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "OTHER_HAY", "WA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
##### WHEAT
build_trends(trends_fris, "WHEAT", "AZ", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "WHEAT", "CA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "WHEAT", "CO", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "WHEAT", "ID", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "WHEAT", "OR", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "WHEAT", "UT", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "WHEAT", "WA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
##### Corn Grain
build_trends(trends_fris, "CORN_GRAIN", "CA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_GRAIN", "CO", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_GRAIN", "ID", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_GRAIN", "OR", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_GRAIN", "WA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
##### Corn Silage
build_trends(trends_fris, "CORN_SILAGE", "AZ", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "CA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "CO", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "ID", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "NM", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "OR", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "UT", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
build_trends(trends_fris, "CORN_SILAGE", "WA", EST_AVE_WU_AF, "Water Application (acre feet/acre)")
```