-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEDA_waterData.Rmd
48 lines (32 loc) · 1.34 KB
/
EDA_waterData.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
---
title: "EDA_waterData"
author: "Andy Pickering"
date: "6/6/2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE,fig.width = 14,fig.width = 10)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r ,fig.width=14}
library(waterData)
library(lubridate)
library(ggplot2)
library(dplyr)
stat_code <- '00003' # daily mean
var_code <- '00060' # streamflow (discharge)
station_id <- '06719505' # Golden Clear Creek Station
dat <- importDVs(staid = station_id,code = var_code, stat=stat_code,sdate = "2009-01-01", edate = "2018-12-31")
#View(dat)
dat <- dat %>%
mutate(year=as.factor(year(dates))) %>%
mutate(month=month(dates)) %>%
mutate(yday=yday(dates))
```
```{r}
dat %>% ggplot(aes(dates,val))+geom_line()+ylab("Streamflow")+xlab("Date")+ggtitle("Timeseries of streamflow at Clear Creek Golden")
dat %>% ggplot(aes(dates,val))+geom_point()+facet_wrap(~month)
dat %>% ggplot(aes(yday,val))+geom_line(col='blue')+facet_wrap(~year)
```