Moved from whalesafe4r/vignettes (3/10/2020)
knitr::opts_chunk$set( collapse = TRUE, comment = "#>", warning = F, message = F, eval = T)
Load dataset sbais
which got ingested from raw data at data-raw/2018-06-01_2018-06-07
by data-raw/sbais.R
using
read_ais_txt()
in R/read.R
.
And get top 20 vessels with data.
library(tidyverse) library(shipr) # devtools::install_local(force=T) # devtools::document() # devtools::load_all() # show sbais dataset, lazy loaded sbais # explicitly attach to environment data(sbais) sbais %>% group_by(name) %>% summarize(n = n()) %>% arrange(desc(n)) %>% head(20) %>% DT::datatable()
ship_name <- "NAUTILUS" dir_cache <- "~/tmp/shipr" # show segments table segs <- get_ship_segments(sbais, ship_name, dir_data = dir_cache) # look at ship segments hist(segs$seg_kmhr) summary(segs$seg_kmhr) which(segs$seg_kmhr>100)
map_ship_segments(segs)
lims <- get_ship_limits(segs, limit_knots = 10, ship_name, dir_data = dir_cache) # show limits table lims map_ship_limits(lims)
pct_dist_ok <- lims %>% filter(label == "<= 10 knots") %>% pull(pct_dist) show_ship_gauge(pct_dist_ok)
show_ship_box(pct_dist_ok)
Note: this value box doesn't really render outside flexdashboard
environment.
Here's an example of using these functions together to create:
ship_gauge()
and ship_box()
in R/viz.R
:
Filter based on shipping lane area. Where are lanes shapefile or larger area to be defined as recommended slowdown area?
r
lanes <- readOGR("C:/Users/Caroline/Desktop/Caroline ArcGIS/shipping_lanes","shipping_lanes_combined")
Compare average vessel speed inside and outside the slowdown area.
Convert km per hour (kmhr
) to knots in segment outputs.
Loop through rendering all ship cards using parameterized ship_card.Rmd
Create directory page to ship cards and summary table of ship stats.
Relate ships to organizations.
Provide overview statistics for study area.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.