Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Dynamic Reporting and Mapping application using the rnrfa package
title author runtime output
RNRFA application for dynamic mapping and reporting
Claudia Vitolo
shiny
html_document
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.

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).

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.

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