---
title: "Oxford"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(aqm)
library(lubridate)
library(xts)
library(dplyr)
library(dygraphs)
```
```{r}
d<-read.csv("/home/aqm/data/met_office.csv")
d$date<-as.Date(d$date)
d$month<-month(d$date,label=TRUE) ## Makes an ordered labeled factor
```
# Temperatures {.tabset}
```{r}
d %>% filter(station=="oxford")->dd
Maxt<-xts(x = dd$tmax, order.by = dd$date)
Mint<-xts(x = dd$tmin, order.by = dd$date)
tmps<-cbind(Max_temp=Maxt,Min_temp=Mint)
dygraph(tmps,group = "Oxford") %>% dyRangeSelector()
```
# Rain
```{r}
xts(x = dd$rain, order.by = dd$date) %>% dygraph(group = "Oxford") %>% dyRangeSelector()
```
# 10 year rolling average rain
```{r}
xts(x = dd$rain, order.by = dd$date) %>% dygraph(group = "Oxford") %>% dyRangeSelector() %>% dyRoller(rollPeriod = 12*10)
```
# 10 year rolling average tmax
```{r}
xts(x = dd$tmax, order.by = dd$date) %>% dygraph(group = "Oxford") %>% dyRangeSelector() %>% dyRoller(rollPeriod = 12*10)
```
# Raw data
```{r}
dt(dd)
```