Versions:
- R 3.5.0
- RStudio 1.1.453
File extensions:
.R
.Rda
.dcf
Shiny app for analysing maritime vessel GPS location and transportation/movement data
- Users select a vessel type
- Users select a vessel name
- The app calculates the observations when the vessel sailed the longest distance between two consecutive time points
Data analysis
Below is pseudocode describing some of the analysis. More detailed code is found in app.R
.
Distance travelled was calculated using speed
and elapsed
variables. The original dataset has been truncated to the below variables to make it smaller in size.
ships %>%
select(LON,LAT,SHIPNAME,ship_type,ELAPSED,SPEED,DATETIME) %>%
rename(SHIP_TYPE=ship_type) %>%
mutate(DISTANCE = SPEED*ELAPSED + lead(SPEED*ELAPSED, default = 0))
User can select a vessel name belonging to the type of ship based on the following code. The distance between latlon location is then calcualted between consecutive time points. The maximum distance is then calculated according to the most recent timestamp.
ships %>% filter(SHIP_TYPE %in% input$select_type & SHIPNAME %in% input$select_name) %>%
top_n(1, DISTANCE) %>%
arrange(desc(DATETIME)) %>%
slice(1) %>%
pull(DISTANCE)
These two consecutive latlon locations (origin and destination) are then plotted on a world map. Locations, vessel info, and distance update as user selects new vessels.
Full code available in app.R
.
Matt Malishev
🔍 Website
🐦 @darwinanddavis
📧 matthew.malishev [at] gmail.com