Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dynamic Reporting and Mapping application using the rnrfa package
---
title: "RNRFA application for dynamic mapping and reporting"
author: "Claudia Vitolo"
runtime: shiny
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,
message=FALSE,
cache = FALSE)
```
The UK National River Flow Archive serves daily streamflow data, spatial rainfall averages and information regarding elevation, geology, land cover and FEH related catchment descriptors. The monitoring stations are divided into networks and operated by different authorities.
Select the name of an operator to generate information about the network.
```{r catalogue}
library(shiny)
library(rnrfa)
allStations <- catalogue()
selectInput(inputId = "operator",
label = "Operator:",
choices = unique(as.character(allStations$operator)),
width = "100%")
someStations <- reactive(catalogue(columnName = "operator",
columnValue = input$operator))
```
Here is a map showing the location of monitoring stations operated by:
__`r renderText(input$operator)`__.
```{r map}
library(leaflet)
renderLeaflet({leaflet(data = someStations()) %>% addTiles() %>%
addMarkers(~lon, ~lat, popup = ~as.character(paste(id,name)))})
```
The network is made of __`r renderText(dim(someStations())[1])`__ stations.
Below is a summary table of the main station metadata.
```{r dt}
library(DT)
renderDataTable(someStations()[,c(1,2,9,10,12)],
options = list(lengthChange = FALSE))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment