Bob Rudis
0abf848fb5
|
9 years ago | |
---|---|---|
R | 9 years ago | |
data | 9 years ago | |
inst/geojson | 9 years ago | |
man | 9 years ago | |
tests | 9 years ago | |
.Rbuildignore | 9 years ago | |
.gitignore | 9 years ago | |
.travis.yml | 9 years ago | |
CONDUCT.md | 9 years ago | |
DESCRIPTION | 9 years ago | |
LICENSE | 9 years ago | |
NAMESPACE | 9 years ago | |
README-map-1.png | 9 years ago | |
README-unnamed-chunk-5-1.png | 9 years ago | |
README-unnamed-chunk-6-1.png | 9 years ago | |
README.Rmd | 9 years ago | |
README.md | 9 years ago | |
asam.Rproj | 9 years ago | |
asam.png | 9 years ago | |
subregions.geojson | 9 years ago |
README.md
asam
is an R package providing tools to access, download, update, process and visualize Anti-shipping Activity Messages (ASAM) Database Files
Anti-shipping Activity Messages (ASAM) include the locations and descriptive accounts of specific hostile acts against ships and mariners. The reports may be useful for recognition, prevention and avoidance of potential hostile activity. The 'asam' package provides a snapshot of the official ASAM database, utilities to update the local database and the official polygons defining the ASAM global regions and subregions.
The following functions are implemented:
asam_refresh
: Refresh ASAM databaseasam_shp
: ASAM (Anti-shipping Activity Messages) Data (shapefile)asam_subregions
: Retrieve ASAM subregions polygons
The following data sets are included:
data(asam_shp)
: Snapshot of the ASAM datasetsystem.file("geojson/asam.geojson", package="asam")
: Official ASAM regions & subregions shapefile
News
- Version 0.0.0.9000 released
Installation
devtools::install_github("hrbrmstr/asam")
Usage
library(asam)
# current verison
packageVersion("asam")
#> [1] '0.0.0.9000'
Test Results
library(asam)
library(testthat)
library(sp)
library(ggplot2)
library(ggthemes)
#> Warning: replacing previous import by 'grid::arrow' when loading 'ggthemes'
#> Warning: replacing previous import by 'grid::unit' when loading 'ggthemes'
#> Warning: replacing previous import by 'scales::alpha' when loading 'ggthemes'
date()
#> [1] "Sat Sep 19 14:51:00 2015"
See the subregion map
subregions <- asam_subregions()
plot(subregions)
Find all the incidents by pirates this year
data(asam_shp)
pirates <- subset(asam_shp,
grepl("pirate", Aggressor, ignore.case=TRUE) &
format(DateOfOcc, "%Y") == "2015")
and plot them
subregions_map <- fortify(subregions)
#> Regions defined for each Polygons
world <- map_data("world")
pirate_pts <- data.frame(pirates)
gg <- ggplot()
gg <- gg + geom_map(data=world, map=world,
aes(x=long, y=lat, map_id=region),
color="black", fill="#e7e7e7", size=0.15)
gg <- gg + geom_map(data=subregions_map, map=subregions_map,
aes(x=long, y=lat, map_id=id),
color="white", fill="white", size=0.15, alpha=0)
gg <- gg + geom_point(data=pirate_pts, color="black", fill="yellow",
aes(x=coords.x1, y=coords.x2), shape=21)
gg <- gg + xlim(-170, 170)
gg <- gg + ylim(-58, 75)
gg <- gg + coord_map("mollweide")
gg <- gg + theme_map()
gg <- gg + theme(panel.background=element_rect(fill="steelblue"))
gg
test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 0 SKIPPED: 0 FAILED: 0
#>
#> DONE
Code of Conduct
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.