-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmethods.html
More file actions
401 lines (359 loc) · 43.1 KB
/
methods.html
File metadata and controls
401 lines (359 loc) · 43.1 KB
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
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Chapter 7 Methods | Hydroinformatics at VT</title>
<meta name="description" content="This bookdown contains notes and exercises for a course in hydroinformatics at Virginia Tech." />
<meta name="generator" content="bookdown 0.21 and GitBook 2.6.7" />
<meta property="og:title" content="Chapter 7 Methods | Hydroinformatics at VT" />
<meta property="og:type" content="book" />
<meta property="og:description" content="This bookdown contains notes and exercises for a course in hydroinformatics at Virginia Tech." />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Chapter 7 Methods | Hydroinformatics at VT" />
<meta name="twitter:description" content="This bookdown contains notes and exercises for a course in hydroinformatics at Virginia Tech." />
<meta name="author" content="JP Gannon" />
<meta name="date" content="2021-02-19" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="prev" href="introactivity.html"/>
<link rel="next" href="applications.html"/>
<script src="libs/header-attrs-2.4.6/header-attrs.js"></script>
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.0/anchor-sections.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.0/anchor-sections.js"></script>
<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li><a href="./">A Minimal Book Example</a></li>
<li class="divider"></li>
<li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Prerequisites</a></li>
<li class="chapter" data-level="2" data-path="intro.html"><a href="intro.html"><i class="fa fa-check"></i><b>2</b> Introduction</a></li>
<li class="chapter" data-level="3" data-path="Plotting.html"><a href="Plotting.html"><i class="fa fa-check"></i><b>3</b> Intro to Plotting</a>
<ul>
<li class="chapter" data-level="3.1" data-path="Plotting.html"><a href="Plotting.html#download-and-install-tidyverse-library"><i class="fa fa-check"></i><b>3.1</b> Download and install tidyverse library</a></li>
<li class="chapter" data-level="3.2" data-path="Plotting.html"><a href="Plotting.html#reading-data"><i class="fa fa-check"></i><b>3.2</b> Reading data</a></li>
<li class="chapter" data-level="3.3" data-path="Plotting.html"><a href="Plotting.html#our-first-ggplot"><i class="fa fa-check"></i><b>3.3</b> Our first ggplot</a></li>
<li class="chapter" data-level="3.4" data-path="Plotting.html"><a href="Plotting.html#change-point-type"><i class="fa fa-check"></i><b>3.4</b> Change point type</a></li>
<li class="chapter" data-level="3.5" data-path="Plotting.html"><a href="Plotting.html#set-colors"><i class="fa fa-check"></i><b>3.5</b> Set colors</a></li>
<li class="chapter" data-level="3.6" data-path="Plotting.html"><a href="Plotting.html#controlling-color-with-a-third-variable-and-other-functions"><i class="fa fa-check"></i><b>3.6</b> Controlling color with a third variable and other functions</a></li>
<li class="chapter" data-level="3.7" data-path="Plotting.html"><a href="Plotting.html#plotting-multiple-groups"><i class="fa fa-check"></i><b>3.7</b> Plotting multiple groups</a></li>
<li class="chapter" data-level="3.8" data-path="Plotting.html"><a href="Plotting.html#facets"><i class="fa fa-check"></i><b>3.8</b> Facets</a></li>
<li class="chapter" data-level="3.9" data-path="Plotting.html"><a href="Plotting.html#two-variable-faceting"><i class="fa fa-check"></i><b>3.9</b> Two variable faceting</a></li>
<li class="chapter" data-level="3.10" data-path="Plotting.html"><a href="Plotting.html#boxplots"><i class="fa fa-check"></i><b>3.10</b> Boxplots</a></li>
<li class="chapter" data-level="3.11" data-path="Plotting.html"><a href="Plotting.html#more-about-color-size-etc"><i class="fa fa-check"></i><b>3.11</b> More about color, size, etc</a></li>
<li class="chapter" data-level="3.12" data-path="Plotting.html"><a href="Plotting.html#multiple-geoms"><i class="fa fa-check"></i><b>3.12</b> Multiple geoms</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="literature.html"><a href="literature.html"><i class="fa fa-check"></i><b>4</b> Literature</a></li>
<li class="chapter" data-level="5" data-path="Programming.html"><a href="Programming.html"><i class="fa fa-check"></i><b>5</b> R Tidyverse Programming Basics</a>
<ul>
<li class="chapter" data-level="5.1" data-path="Programming.html"><a href="Programming.html#introduction"><i class="fa fa-check"></i><b>5.1</b> Introduction</a></li>
<li class="chapter" data-level="5.2" data-path="Programming.html"><a href="Programming.html#you-can-use-r-as-a-calculator"><i class="fa fa-check"></i><b>5.2</b> You can use R as a calculator</a></li>
<li class="chapter" data-level="5.3" data-path="Programming.html"><a href="Programming.html#you-can-create-new-objects-using--"><i class="fa fa-check"></i><b>5.3</b> You can create new objects using <-</a></li>
<li class="chapter" data-level="5.4" data-path="Programming.html"><a href="Programming.html#using-functions"><i class="fa fa-check"></i><b>5.4</b> Using functions</a></li>
<li class="chapter" data-level="5.5" data-path="Programming.html"><a href="Programming.html#read-in-some-data."><i class="fa fa-check"></i><b>5.5</b> Read in some data.</a></li>
<li class="chapter" data-level="5.6" data-path="Programming.html"><a href="Programming.html#wait-hold-up.-what-is-a-tibble"><i class="fa fa-check"></i><b>5.6</b> Wait, hold up. What is a tibble?</a></li>
<li class="chapter" data-level="5.7" data-path="Programming.html"><a href="Programming.html#data-wrangling-in-dplyr"><i class="fa fa-check"></i><b>5.7</b> Data wrangling in dplyr</a>
<ul>
<li class="chapter" data-level="5.7.1" data-path="Programming.html"><a href="Programming.html#filter---returns-rows-that-meet-specified-conditions"><i class="fa fa-check"></i><b>5.7.1</b> filter() - returns rows that meet specified conditions</a></li>
<li class="chapter" data-level="5.7.2" data-path="Programming.html"><a href="Programming.html#arrange---reorders-rows"><i class="fa fa-check"></i><b>5.7.2</b> arrange() - reorders rows</a></li>
<li class="chapter" data-level="5.7.3" data-path="Programming.html"><a href="Programming.html#select---pull-out-variables-columns"><i class="fa fa-check"></i><b>5.7.3</b> select() - pull out variables (columns)</a></li>
<li class="chapter" data-level="5.7.4" data-path="Programming.html"><a href="Programming.html#mutate---create-new-variables-columns-or-reformat-existing-ones"><i class="fa fa-check"></i><b>5.7.4</b> mutate() - create new variables (columns) or reformat existing ones</a></li>
<li class="chapter" data-level="5.7.5" data-path="Programming.html"><a href="Programming.html#summarize---collapse-groups-of-values-into-summary-stats"><i class="fa fa-check"></i><b>5.7.5</b> summarize() - collapse groups of values into summary stats</a></li>
</ul></li>
<li class="chapter" data-level="5.8" data-path="Programming.html"><a href="Programming.html#filter"><i class="fa fa-check"></i><b>5.8</b> Filter</a>
<ul>
<li class="chapter" data-level="5.8.1" data-path="Programming.html"><a href="Programming.html#multiple-conditions"><i class="fa fa-check"></i><b>5.8.1</b> Multiple conditions</a></li>
</ul></li>
<li class="chapter" data-level="5.9" data-path="Programming.html"><a href="Programming.html#arrange"><i class="fa fa-check"></i><b>5.9</b> Arrange</a></li>
<li class="chapter" data-level="5.10" data-path="Programming.html"><a href="Programming.html#select"><i class="fa fa-check"></i><b>5.10</b> Select</a></li>
<li class="chapter" data-level="5.11" data-path="Programming.html"><a href="Programming.html#mutate"><i class="fa fa-check"></i><b>5.11</b> Mutate</a></li>
<li class="chapter" data-level="5.12" data-path="Programming.html"><a href="Programming.html#summarize"><i class="fa fa-check"></i><b>5.12</b> Summarize</a></li>
<li class="chapter" data-level="5.13" data-path="Programming.html"><a href="Programming.html#multiple-operations-with-pipes"><i class="fa fa-check"></i><b>5.13</b> Multiple operations with pipes</a>
<ul>
<li class="chapter" data-level="5.13.1" data-path="Programming.html"><a href="Programming.html#lets-say-we-want-to-tell-r-to-make-a-pbj-sandwich-by-using-the-pbbread-jbread-and-joinslices-functions-and-the-data-ingredients.-if-we-do-this-saving-each-step-if-would-look-like-this"><i class="fa fa-check"></i><b>5.13.1</b> Let’s say we want to tell R to make a PB&J sandwich by using the pbbread(), jbread(), and joinslices() functions and the data “ingredients.” If we do this saving each step if would look like this:</a></li>
<li class="chapter" data-level="5.13.2" data-path="Programming.html"><a href="Programming.html#if-we-nest-the-functions-together-we-get-this"><i class="fa fa-check"></i><b>5.13.2</b> If we nest the functions together we get this</a></li>
<li class="chapter" data-level="5.13.3" data-path="Programming.html"><a href="Programming.html#using-the-pipe-it-would-look-like-this"><i class="fa fa-check"></i><b>5.13.3</b> Using the pipe it would look like this</a></li>
<li class="chapter" data-level="5.13.4" data-path="Programming.html"><a href="Programming.html#when-you-use-the-pipe-it-basically-takes-whatever-came-out-of-the-first-function-and-puts-it-into-the-data-argument-for-the-next-one"><i class="fa fa-check"></i><b>5.13.4</b> When you use the pipe, it basically takes whatever came out of the first function and puts it into the data argument for the next one</a></li>
</ul></li>
<li class="chapter" data-level="5.14" data-path="Programming.html"><a href="Programming.html#save-your-results-to-a-new-tibble"><i class="fa fa-check"></i><b>5.14</b> Save your results to a new tibble</a></li>
<li class="chapter" data-level="5.15" data-path="Programming.html"><a href="Programming.html#what-about-nas"><i class="fa fa-check"></i><b>5.15</b> What about NAs?</a></li>
<li class="chapter" data-level="5.16" data-path="Programming.html"><a href="Programming.html#what-are-some-things-you-think-ill-ask-you-to-do-for-the-activity-next-class"><i class="fa fa-check"></i><b>5.16</b> What are some things you think I’ll ask you to do for the activity next class?</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="introactivity.html"><a href="introactivity.html"><i class="fa fa-check"></i><b>6</b> Intro Skills Activity</a>
<ul>
<li class="chapter" data-level="6.1" data-path="introactivity.html"><a href="introactivity.html#problem-1"><i class="fa fa-check"></i><b>6.1</b> Problem 1</a></li>
<li class="chapter" data-level="6.2" data-path="introactivity.html"><a href="introactivity.html#problem-2"><i class="fa fa-check"></i><b>6.2</b> Problem 2</a></li>
<li class="chapter" data-level="6.3" data-path="introactivity.html"><a href="introactivity.html#problem-3"><i class="fa fa-check"></i><b>6.3</b> Problem 3</a></li>
<li class="chapter" data-level="6.4" data-path="introactivity.html"><a href="introactivity.html#problem-4"><i class="fa fa-check"></i><b>6.4</b> Problem 4</a></li>
<li class="chapter" data-level="6.5" data-path="introactivity.html"><a href="introactivity.html#problem-5"><i class="fa fa-check"></i><b>6.5</b> Problem 5</a></li>
<li class="chapter" data-level="6.6" data-path="introactivity.html"><a href="introactivity.html#problem-6"><i class="fa fa-check"></i><b>6.6</b> Problem 6</a></li>
</ul></li>
<li class="chapter" data-level="7" data-path="methods.html"><a href="methods.html"><i class="fa fa-check"></i><b>7</b> Methods</a></li>
<li class="chapter" data-level="8" data-path="applications.html"><a href="applications.html"><i class="fa fa-check"></i><b>8</b> Applications</a>
<ul>
<li class="chapter" data-level="8.1" data-path="applications.html"><a href="applications.html#example-one"><i class="fa fa-check"></i><b>8.1</b> Example one</a></li>
<li class="chapter" data-level="8.2" data-path="applications.html"><a href="applications.html#example-two"><i class="fa fa-check"></i><b>8.2</b> Example two</a></li>
</ul></li>
<li class="chapter" data-level="9" data-path="stats.html"><a href="stats.html"><i class="fa fa-check"></i><b>9</b> Intro/Review of Basic Statistics</a>
<ul>
<li class="chapter" data-level="9.1" data-path="stats.html"><a href="stats.html#reading-for-this-section-statistical-methods-in-water-resources-chapter-1"><i class="fa fa-check"></i><b>9.1</b> Reading for this section: Statistical Methods in Water Resources: Chapter 1</a></li>
<li class="chapter" data-level="9.2" data-path="stats.html"><a href="stats.html#questions-for-today"><i class="fa fa-check"></i><b>9.2</b> Questions for today:</a>
<ul>
<li class="chapter" data-level="9.2.1" data-path="stats.html"><a href="stats.html#what-is-the-difference-between-a-sample-and-a-population"><i class="fa fa-check"></i><b>9.2.1</b> What is the difference between a sample and a population?</a></li>
<li class="chapter" data-level="9.2.2" data-path="stats.html"><a href="stats.html#how-do-we-look-at-the-distribution-of-data-in-a-sample"><i class="fa fa-check"></i><b>9.2.2</b> How do we look at the distribution of data in a sample?</a></li>
<li class="chapter" data-level="9.2.3" data-path="stats.html"><a href="stats.html#how-do-we-measure-aspects-of-a-distribution"><i class="fa fa-check"></i><b>9.2.3</b> How do we measure aspects of a distribution?</a></li>
<li class="chapter" data-level="9.2.4" data-path="stats.html"><a href="stats.html#what-is-a-normal-distribution"><i class="fa fa-check"></i><b>9.2.4</b> What is a normal distribution?</a></li>
<li class="chapter" data-level="9.2.5" data-path="stats.html"><a href="stats.html#stack-plots-to-compare-histogram-and-pdf"><i class="fa fa-check"></i><b>9.2.5</b> Stack plots to compare histogram and pdf</a></li>
</ul></li>
<li class="chapter" data-level="9.3" data-path="stats.html"><a href="stats.html#what-is-the-difference-between-a-sample-and-a-population."><i class="fa fa-check"></i><b>9.3</b> What is the difference between a sample and a population.</a></li>
<li class="chapter" data-level="9.4" data-path="stats.html"><a href="stats.html#measuring-our-sample-distribution-central-tendency."><i class="fa fa-check"></i><b>9.4</b> Measuring our sample distribution: central tendency.</a>
<ul>
<li class="chapter" data-level="9.4.1" data-path="stats.html"><a href="stats.html#so-whats-a-weighted-average"><i class="fa fa-check"></i><b>9.4.1</b> So what’s a weighted average?</a></li>
</ul></li>
<li class="chapter" data-level="9.5" data-path="stats.html"><a href="stats.html#measures-of-variability"><i class="fa fa-check"></i><b>9.5</b> Measures of variability</a></li>
<li class="chapter" data-level="9.6" data-path="stats.html"><a href="stats.html#what-is-a-normal-distribution-and-how-can-we-determine-if-we-have-one"><i class="fa fa-check"></i><b>9.6</b> What is a normal distribution and how can we determine if we have one?</a></li>
<li class="chapter" data-level="9.7" data-path="stats.html"><a href="stats.html#load-the-tidyverse-and-patchwork-libraries-and-read-in-the-flashy-and-pine-datasets."><i class="fa fa-check"></i><b>9.7</b> 1. Load the tidyverse and patchwork libraries and read in the Flashy and Pine datasets.</a></li>
<li class="chapter" data-level="9.8" data-path="stats.html"><a href="stats.html#using-the-flashy-dataset-make-a-pdf-of-the-average-basin-rainfall-pptavg_basin-for-the-northeast-aggecoregion.-on-that-pdf-add-vertical-lines-showing-the-mean-median-standard-deviation-and-iqr.-make-each-a-different-color-and-note-which-is-which-in-a-typed-answer-below-this-question.-or-if-you-want-an-extra-challenged-make-a-custom-legend-that-shows-this"><i class="fa fa-check"></i><b>9.8</b> 2. Using the flashy dataset, make a pdf of the average basin rainfall (PPTAVG_BASIN) for the NorthEast AGGECOREGION. On that pdf, add vertical lines showing the mean, median, standard deviation, and IQR. Make each a different color and note which is which in a typed answer below this question. (or if you want an extra challenged, make a custom legend that shows this)</a></li>
<li class="chapter" data-level="9.9" data-path="stats.html"><a href="stats.html#perform-a-shapiro-wilk-test-for-normality-on-the-data-from-question-2.-using-the-results-from-that-test-and-the-plot-and-stats-from-question-2-discuss-whether-or-not-the-distribution-is-normal."><i class="fa fa-check"></i><b>9.9</b> 3. Perform a Shapiro-Wilk test for normality on the data from question 2. Using the results from that test and the plot and stats from question 2, discuss whether or not the distribution is normal.</a></li>
<li class="chapter" data-level="9.10" data-path="stats.html"><a href="stats.html#make-a-plot-that-shows-the-distribution-of-the-data-from-the-pine-watershed-and-the-nfdr-watershed-two-pdfs-on-the-same-plot.-log-the-x-axis."><i class="fa fa-check"></i><b>9.10</b> 4. Make a plot that shows the distribution of the data from the PINE watershed and the NFDR watershed (two pdfs on the same plot). Log the x axis.</a></li>
<li class="chapter" data-level="9.11" data-path="stats.html"><a href="stats.html#you-want-to-compare-how-variable-the-discharge-is-in-each-of-the-watersheds-in-question-4.-which-measure-of-spread-would-you-use-and-why-if-you-wanted-to-measure-the-central-tendency-which-measure-would-you-use-and-why"><i class="fa fa-check"></i><b>9.11</b> 5. You want to compare how variable the discharge is in each of the watersheds in question 4. Which measure of spread would you use and why? If you wanted to measure the central tendency which measure would you use and why?</a></li>
<li class="chapter" data-level="9.12" data-path="stats.html"><a href="stats.html#compute-3-measures-of-spread-and-2-measures-of-central-tendency-for-the-pine-and-nfdr-watershed.-hint-use-group_by-and-summarize-be-sure-your-code-outputs-the-result.-which-watershed-has-higher-flow-which-one-has-more-variable-flow-how-do-you-know"><i class="fa fa-check"></i><b>9.12</b> 6. Compute 3 measures of spread and 2 measures of central tendency for the PINE and NFDR watershed. (hint: use group_by() and summarize()) Be sure your code outputs the result. Which watershed has higher flow? Which one has more variable flow? How do you know?</a></li>
</ul></li>
<li class="chapter" data-level="10" data-path="final-words.html"><a href="final-words.html"><i class="fa fa-check"></i><b>10</b> Final Words</a></li>
<li class="chapter" data-level="11" data-path="getdata.html"><a href="getdata.html"><i class="fa fa-check"></i><b>11</b> Joins, Pivots, and USGS dataRetrieval</a>
<ul>
<li class="chapter" data-level="11.1" data-path="getdata.html"><a href="getdata.html#goals-for-today"><i class="fa fa-check"></i><b>11.1</b> Goals for today</a>
<ul>
<li class="chapter" data-level="11.1.1" data-path="getdata.html"><a href="getdata.html#get-familiar-with-the-dataretrieval-package"><i class="fa fa-check"></i><b>11.1.1</b> 1. Get familiar with the dataRetrieval package</a></li>
<li class="chapter" data-level="11.1.2" data-path="getdata.html"><a href="getdata.html#learn-about-long-vs.-wide-data-and-how-to-change-between-them"><i class="fa fa-check"></i><b>11.1.2</b> 2. Learn about long vs. wide data and how to change between them</a></li>
<li class="chapter" data-level="11.1.3" data-path="getdata.html"><a href="getdata.html#brief-intro-to-joins"><i class="fa fa-check"></i><b>11.1.3</b> 3. Brief intro to joins</a></li>
<li class="chapter" data-level="11.1.4" data-path="getdata.html"><a href="getdata.html#prep-question-how-would-you-get-data-from-the-usgs-non-r"><i class="fa fa-check"></i><b>11.1.4</b> Prep question: How would you get data from the USGS (non-R)?</a></li>
</ul></li>
<li class="chapter" data-level="11.2" data-path="getdata.html"><a href="getdata.html#install-the-dataretrieval-package.-load-it-and-the-tidyverse."><i class="fa fa-check"></i><b>11.2</b> Install the dataRetrieval package. Load it and the tidyverse.</a></li>
<li class="chapter" data-level="11.3" data-path="getdata.html"><a href="getdata.html#exploring-what-dataretrieval-can-do."><i class="fa fa-check"></i><b>11.3</b> Exploring what dataRetrieval can do.</a></li>
<li class="chapter" data-level="11.4" data-path="getdata.html"><a href="getdata.html#so-how-do-you-find-the-site-ids-for-downloading-data"><i class="fa fa-check"></i><b>11.4</b> So how do you find the site ids for downloading data?</a></li>
<li class="chapter" data-level="11.5" data-path="getdata.html"><a href="getdata.html#ok-lets-download-some-data"><i class="fa fa-check"></i><b>11.5</b> OK let’s download some data!</a></li>
<li class="chapter" data-level="11.6" data-path="getdata.html"><a href="getdata.html#pivoting-wide-and-long-data"><i class="fa fa-check"></i><b>11.6</b> Pivoting: wide and long data</a>
<ul>
<li class="chapter" data-level="11.6.1" data-path="getdata.html"><a href="getdata.html#long"><i class="fa fa-check"></i><b>11.6.1</b> LONG</a></li>
<li class="chapter" data-level="11.6.2" data-path="getdata.html"><a href="getdata.html#wide"><i class="fa fa-check"></i><b>11.6.2</b> WIDE</a></li>
<li class="chapter" data-level="11.6.3" data-path="getdata.html"><a href="getdata.html#why"><i class="fa fa-check"></i><b>11.6.3</b> Why?</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>References</a></li>
<li class="chapter" data-level="12" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html"><i class="fa fa-check"></i><b>12</b> Joins Pivots dataRetrieval Activity</a>
<ul>
<li class="chapter" data-level="12.0.1" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#load-the-tidyverse-dataretrieval-and-patchwork-packages."><i class="fa fa-check"></i><b>12.0.1</b> Load the tidyverse, dataRetrieval, and patchwork packages.</a></li>
<li class="chapter" data-level="12.0.2" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#using-readnwisqw-read-all-the-chloride-00940-data-for-the-new-river-at-radford-03171000."><i class="fa fa-check"></i><b>12.0.2</b> 1. Using readNWISqw(), read all the chloride (00940) data for the New River at Radford (03171000).</a></li>
<li class="chapter" data-level="12.0.3" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#use-the-head-function-to-print-the-beginning-of-the-output-from-readnwisqw."><i class="fa fa-check"></i><b>12.0.3</b> Use the head() function to print the beginning of the output from readNWISqw.</a></li>
<li class="chapter" data-level="12.0.4" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#using-the-readnwisdv-daily-values-function-download-discharge-00060-temperature-00003-and-specific-conductivity-00095-for-the-new-river-at-radford-from-2007-to-2009-regular-year."><i class="fa fa-check"></i><b>12.0.4</b> 2. Using the readNWISdv (daily values) function, download discharge (00060), temperature (00003), and specific conductivity (00095) for the New River at Radford from 2007 to 2009 (regular year).</a></li>
<li class="chapter" data-level="12.0.5" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#use-renamenwiscolumns-to-rename-the-output-of-the-download."><i class="fa fa-check"></i><b>12.0.5</b> Use renameNWIScolumns() to rename the output of the download.</a></li>
<li class="chapter" data-level="12.0.6" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#use-head-to-show-the-beginning-of-the-results-of-your-download."><i class="fa fa-check"></i><b>12.0.6</b> Use head() to show the beginning of the results of your download.</a></li>
<li class="chapter" data-level="12.0.7" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#do-a-left-join-on-newphys-and-newriver-to-add-the-chloride-data-to-the-daily-discharge-temp-and-conductivity-data.-hint-you-will-join-on-the-date."><i class="fa fa-check"></i><b>12.0.7</b> 3. Do a left join on newphys and newriver to add the chloride data to the daily discharge, temp, and conductivity data. hint: you will join on the date.</a></li>
<li class="chapter" data-level="12.0.8" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#preview-your-data-below-the-chunk-using-head"><i class="fa fa-check"></i><b>12.0.8</b> Preview your data below the chunk using head()</a></li>
<li class="chapter" data-level="12.0.9" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#create-a-line-plot-of-date-x-and-flow-y.-create-a-scatter-plot-of-date-x-and-chloride-concentration-y.-put-the-graphs-on-top-of-each-other-using-the-patchwork-library."><i class="fa fa-check"></i><b>12.0.9</b> 4. Create a line plot of Date (x) and Flow (y). Create a scatter plot of Date (x) and chloride concentration (y). Put the graphs on top of each other using the patchwork library.</a></li>
<li class="chapter" data-level="12.0.10" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#create-a-scatter-plot-of-specific-conductivity-y-and-chloride-x.-challenge-what-could-you-do-to-get-rid-of-the-warning-this-plot-generates-about-nas."><i class="fa fa-check"></i><b>12.0.10</b> 5. Create a scatter plot of Specific Conductivity (y) and Chloride (x). Challenge: what could you do to get rid of the warning this plot generates about NAs.</a></li>
<li class="chapter" data-level="12.0.11" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#read-in-the-gg-chem-subset-data-and-plot-mg_e1-x-vs-ca_e1-y-as-points."><i class="fa fa-check"></i><b>12.0.11</b> 6. Read in the GG chem subset data and plot Mg_E1 (x) vs Ca_E1 (y) as points.</a></li>
<li class="chapter" data-level="12.0.12" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#we-want-to-look-at-concentrations-of-each-element-in-the-6-dataset-along-the-stream-distance-which-is-difficult-in-the-current-format.-pivot-the-data-into-a-long-format-the-data-from-ca-mg-and-na-_e1-columns-should-be-pivoted."><i class="fa fa-check"></i><b>12.0.12</b> 7. We want to look at concentrations of each element in the #6 dataset along the stream (Distance), which is difficult in the current format. Pivot the data into a long format, the data from Ca, Mg, and Na _E1 columns should be pivoted.</a></li>
<li class="chapter" data-level="12.0.13" data-path="joins-pivots-dataretrieval-activity.html"><a href="joins-pivots-dataretrieval-activity.html#make-line-plots-of-each-element-where-y-is-the-concentration-and-x-is-distance.-use-facet_wrap-to-create-a-separate-plot-for-each-element-and-use-the-scales-argument-of-facet_wrap-to-allow-each-plot-to-have-different-y-limits."><i class="fa fa-check"></i><b>12.0.13</b> Make line plots of each element where y is the concentration and x is distance. Use facet_wrap() to create a separate plot for each element and use the “scales” argument of facet_wrap to allow each plot to have different y limits.</a></li>
</ul></li>
<li class="chapter" data-level="13" data-path="Summative1.html"><a href="Summative1.html"><i class="fa fa-check"></i><b>13</b> Summative Activity 1</a>
<ul>
<li class="chapter" data-level="13.1" data-path="Summative1.html"><a href="Summative1.html#test-1"><i class="fa fa-check"></i><b>13.1</b> Test 1</a>
<ul>
<li class="chapter" data-level="13.1.1" data-path="Summative1.html"><a href="Summative1.html#instructions"><i class="fa fa-check"></i><b>13.1.1</b> Instructions</a></li>
</ul></li>
<li class="chapter" data-level="13.2" data-path="Summative1.html"><a href="Summative1.html#load-the-tidyverse-lubridate-and-dataretrieval-packages."><i class="fa fa-check"></i><b>13.2</b> 1. Load the tidyverse, lubridate, and dataRetrieval packages.</a></li>
<li class="chapter" data-level="13.3" data-path="Summative1.html"><a href="Summative1.html#read-in-the-mcdonald-hollow-dataset-in-the-project-folder."><i class="fa fa-check"></i><b>13.3</b> 2. Read in the McDonald Hollow dataset in the project folder.</a>
<ul>
<li class="chapter" data-level="13.3.1" data-path="Summative1.html"><a href="Summative1.html#what-are-the-data-types-of-the-first-three-columns"><i class="fa fa-check"></i><b>13.3.1</b> What are the data types of the first three columns?</a></li>
<li class="chapter" data-level="13.3.2" data-path="Summative1.html"><a href="Summative1.html#how-long-is-the-data-number-of-rows"><i class="fa fa-check"></i><b>13.3.2</b> How long is the data (number of rows)?</a></li>
<li class="chapter" data-level="13.3.3" data-path="Summative1.html"><a href="Summative1.html#what-is-the-name-of-the-last-column"><i class="fa fa-check"></i><b>13.3.3</b> What is the name of the last column?</a></li>
</ul></li>
<li class="chapter" data-level="13.4" data-path="Summative1.html"><a href="Summative1.html#plot-the-stage-of-the-stream-stage_m_pt-on-the-y-axis-as-a-line-and-the-date-on-the-x.-these-stage-data-are-in-meters-convert-them-to-centimeters-for-the-plot."><i class="fa fa-check"></i><b>13.4</b> 3. Plot the stage of the stream (Stage_m_pt) on the y axis as a line and the date on the x. These stage data are in meters, convert them to centimeters for the plot.</a>
<ul>
<li class="chapter" data-level="13.4.1" data-path="Summative1.html"><a href="Summative1.html#for-all-plots-in-this-test-label-axes-properly-and-use-a-theme-other-than-the-default."><i class="fa fa-check"></i><b>13.4.1</b> For all plots in this test, label axes properly and use a theme other than the default.</a></li>
</ul></li>
<li class="chapter" data-level="13.5" data-path="Summative1.html"><a href="Summative1.html#we-want-to-look-at-the-big-event-that-happens-from-november-11-2020-to-november-27-2020.-filter-the-dataset-down-to-this-time-frame-and-save-it-separately.-make-a-plot-with-the-same-setup-as-in-3-with-these-newly-saved-data."><i class="fa fa-check"></i><b>13.5</b> 4. We want to look at the big event that happens from November 11, 2020 to November 27, 2020. Filter the dataset down to this time frame and save it separately. Make a plot with the same setup as in #3 with these newly saved data.</a></li>
<li class="chapter" data-level="13.6" data-path="Summative1.html"><a href="Summative1.html#for-this-storm-we-are-curious-about-how-conductivity-changes-with-the-stream-level.-to-do-this-make-a-scatter-plot-that-shows-stage-on-the-x-axis-and-specific-conductivity-spc_mscm-on-the-y.-units-mscm-color-the-points-on-the-plot-using-the-datetime-column.-use-the-plot-to-describe-how-specific-conductivity-changes-with-stream-stage-throughout-the-storm.-not-functionally-just-how-the-values-change"><i class="fa fa-check"></i><b>13.6</b> 5. For this storm, we are curious about how conductivity changes with the stream level. To do this, make a scatter plot that shows Stage on the x axis and specific conductivity (SpC_mScm) on the y. (units: mScm) Color the points on the plot using the datetime column. Use the plot to describe how specific conductivity changes with stream stage throughout the storm. (not functionally, just how the values change)</a></li>
<li class="chapter" data-level="13.7" data-path="Summative1.html"><a href="Summative1.html#continuing-to-look-at-the-storm-as-an-exploratory-data-analysis-we-want-to-create-a-plot-that-shows-all-the-parameters-measured.-to-do-this-pivot-the-storm-event-data-so-there-is-a-column-that-has-the-values-for-all-the-parameters-measured-as-individual-rows-along-with-another-column-that-identifies-the-type-of-measurement.-then-use-facet_wrap-with-the-name-column-or-whatever-you-call-it-as-the-facet.-be-sure-to-set-the-parameters-of-facet_wrap-such-that-the-y-axes-are-all-allowed-to-be-different-ranges."><i class="fa fa-check"></i><b>13.7</b> 6. Continuing to look at the storm, as an exploratory data analysis, we want to create a plot that shows all the parameters measured. To do this, pivot the STORM EVENT data so there is a column that has the values for all the parameters measured as individual rows, along with another column that identifies the type of measurement. Then use facet_wrap with the “name” column (or whatever you call it) as the facet. Be sure to set the parameters of facet_wrap such that the y axes are all allowed to be different ranges.</a></li>
<li class="chapter" data-level="13.8" data-path="Summative1.html"><a href="Summative1.html#we-want-to-create-a-table-that-clearly-shows-the-differences-in-water-temperature-for-the-three-months-at-the-two-locations-flow-and-pool-in-the-full-data-set-not-the-storm-subset.-to-do-this-create-a-new-column-in-the-full-dataset-called-month-and-set-it-equal-to-the-month-of-the-datetime-column-using-the-month-function.-then-group-your-dataset-by-month-and-summarize-temperature-at-each-location-by-mean.-save-these-results-to-a-new-object-and-output-it-so-it-appears-below-your-chunk-when-you-knit.-be-sure-the-object-has-descriptive-column-names."><i class="fa fa-check"></i><b>13.8</b> 7. We want to create a table that clearly shows the differences in water temperature for the three months at the two locations (flow and pool) in the FULL data set (not the storm subset). To do this: Create a new column in the full dataset called “month” and set it equal to the month of the datetime column using the month() function. Then group your dataset by month and summarize temperature at each location by mean. Save these results to a new object and output it so it appears below your chunk when you knit. Be sure the object has descriptive column names.</a></li>
<li class="chapter" data-level="13.9" data-path="Summative1.html"><a href="Summative1.html#plot-the-distribution-of-the-flow-temperature-and-show-as-vertical-lines-on-the-plot-the-mean-median-and-iqr.-be-careful-about-how-you-show-iqr.-look-at-the-definition-and-then-think-about-how-you-would-put-it-on-the-plot.-describe-in-the-text-above-the-chunk-what-color-is-what-statistic-in-the-plot.-using-the-shape-of-the-distribution-and-the-measures-you-plotted-explain-why-you-think-the-distribution-is-normal-or-not.-what-statistical-test-could-you-perform-to-see-if-it-is-normal"><i class="fa fa-check"></i><b>13.9</b> 8. Plot the distribution of the flow temperature and show as vertical lines on the plot the mean, median, and IQR. Be careful about how you show IQR. Look at the definition and then think about how you would put it on the plot. Describe in the text above the chunk what color is what statistic in the plot. Using the shape of the distribution and the measures you plotted, explain why you think the distribution is normal or not. What statistical test could you perform to see if it is normal?</a></li>
<li class="chapter" data-level="13.10" data-path="Summative1.html"><a href="Summative1.html#in-this-question-we-will-get-and-format-data-for-three-usgs-gages."><i class="fa fa-check"></i><b>13.10</b> 9. In this question we will get and format data for three USGS gages.</a>
<ul>
<li class="chapter" data-level="13.10.1" data-path="Summative1.html"><a href="Summative1.html#a.-read-and-save-the-gage-information-for-the-three-gages-using-readnwissite."><i class="fa fa-check"></i><b>13.10.1</b> a. Read and save the gage information for the three gages using readNWISsite().</a></li>
<li class="chapter" data-level="13.10.2" data-path="Summative1.html"><a href="Summative1.html#b.-use-the-readnwisdv-function-to-read-and-save-the-daily-discharge-values-for-the-following-three-gages-for-the-2020-water-year-10-01-2019-to-9-30-2020.-and-then-use-the-renamenwiscolumns-function-to-make-the-names-human-friendly."><i class="fa fa-check"></i><b>13.10.2</b> b. Use the readNWISdv() function to read and save the daily discharge values for the following three gages for the 2020 water year (10-01-2019 to 9-30-2020). And then use the renameNWIScolumns() function to make the names human-friendly.</a></li>
<li class="chapter" data-level="13.10.3" data-path="Summative1.html"><a href="Summative1.html#c.-join-the-gage-site-information-from-a-to-the-data-from-b-so-you-can-reference-the-gages-by-their-names."><i class="fa fa-check"></i><b>13.10.3</b> c. Join the gage site information from (a) to the data from (b) so you can reference the gages by their names.</a></li>
</ul></li>
<li class="chapter" data-level="13.11" data-path="Summative1.html"><a href="Summative1.html#using-the-data-from-9-plot-flow-on-the-y-axis-and-date-on-the-x-axis-showing-the-data-as-a-line-and-coloring-by-gage-name."><i class="fa fa-check"></i><b>13.11</b> 10. Using the data from #9, Plot flow on the y axis and date on the x axis, showing the data as a line, and coloring by gage name.</a></li>
</ul></li>
<li class="chapter" data-level="14" data-path="lfas.html"><a href="lfas.html"><i class="fa fa-check"></i><b>14</b> Low Flow Analysis</a></li>
<li class="chapter" data-level="15" data-path="floods.html"><a href="floods.html"><i class="fa fa-check"></i><b>15</b> Flood Frequency Analysis</a>
<ul>
<li class="chapter" data-level="15.1" data-path="floods.html"><a href="floods.html#challenge-create-a-function"><i class="fa fa-check"></i><b>15.1</b> Challenge: Create a function</a></li>
</ul></li>
<li class="divider"></li>
<li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Hydroinformatics at VT</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="methods" class="section level1" number="7">
<h1><span class="header-section-number">Chapter 7</span> Methods</h1>
<p>We describe our methods in this chapter.</p>
</div>
</section>
</div>
</div>
</div>
<a href="introactivity.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="applications.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": null,
"text": null
},
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": ["Hydroinformatics_Bookdown.pdf", "Hydroinformatics_Bookdown.epub"],
"toc": {
"collapse": "subsection"
}
});
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
var src = "true";
if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:")
if (/^https?:/.test(src))
src = src.replace(/^https?:/, '');
script.src = src;
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>