Ashley You
8th September, 2017
The UK Fisheries Activity Explorer dashboard allows an interactive exploration into commercial fishing activity in the UK and surrounding areas from 2014 to 2017 (year to date).
There are two sections: Charts and Map of Ports.
Data for the dashboard's Charts section were sourced from UK Government website. Fishing ports were geolocated using geocode() function from ggmap package, thus producing the map in Map of Ports section. Let's take a look at the master dataset fisheriesData.
head(fisheriesData,2)
Date Port.of.Landing Port.NUTS.2.area Port.Nationality
1 2014-01-01 Aberdaran West Wales and the Valleys Wales
2 2014-01-01 Aberdaran West Wales and the Valleys Wales
Vessel.Nationality Length.Group Species Species.Group
1 UK 10m&Under Crabs Shellfish
2 UK 10m&Under Lobsters Shellfish
Live.weight..tonnes. Landed.weight..tonnes. Value..000s. Lon
1 0.2826 0.2826 0.33912 -4.711515
2 0.0030 0.0030 0.04300 -4.711515
Lat
1 52.80473
2 52.80473
The App was designed using shiny's flexdashboard package and deployed on shinyapps.io website. Plotly package is applied to all charts to enhance interactivity. Below are sample codes where ggplotly responds to user input to radio button Criteria.
string <- reactive(substring(input$Criteria,1,5))
output$plot1 <- renderPlotly ({
if (string() == "Live ") {
p1 <- ggplot(fisheries_trim, aes(x = Month.number, y = Live.Weight, fill = Year, colour = Year)) + geom_point(size = 6, shape = 18) + scale_x_continuous(name="Month of the Year", breaks=seq(1,12,1),labels= c("Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec")) + scale_y_continuous(name="Live Weight in '000 tonnes") + ggtitle("Fisheries activity over 12 months (Live Weight)") + theme(plot.title = element_text(size=12, face="bold"))
ggplotly(p1)%>%layout(margin=list(l=70, b=120))
}
Full codes can be found in my github repository here - please open the link in a new tab.
Using shiny with flexdashboard. Basics
L. Kiefer. A guide to building an interactive flexdashboard. 22nd January 2017. App example
J. Paulson. R Presentations. 15th January, 2017. Articles
UK and foreign vessels landings by UK port and UK vessel landings abroad: 2014, 2015, 2016 and 2017 (year to date). Latest dataset