Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrbrmstr/lineworkmaps
Use Project Linework maps easily in R
https://github.com/hrbrmstr/lineworkmaps
Last synced: about 1 month ago
JSON representation
Use Project Linework maps easily in R
- Host: GitHub
- URL: https://github.com/hrbrmstr/lineworkmaps
- Owner: hrbrmstr
- License: other
- Created: 2015-07-21T03:31:51.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-01T01:16:18.000Z (about 9 years ago)
- Last Synced: 2024-06-13T00:33:36.522Z (3 months ago)
- Language: R
- Size: 34.6 MB
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output:
md_document:
variant: markdown_github
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README_files/README-"
)
```lineworkmaps is compilation of [Project Linework](http://projectlinework.org/) maps in `SpatialPolygonsDataFrame` and `ggplot2` fortified objects ready for mapping, et al.
I took a minimalist approach to the package in that I don't have every linework (the calligraphy one seemed less than useful) and the functions only work for Admin 0 & Admin 1 polygons.
Please file an issue if there is functionality you'd like to see that isn't included. The package is at a very early stage so almost no suggestion will be turned away!
To get an idea of what you can do with these lineworks in R, head on over to [RPubs](http://rpubs.com/hrbrmstr/project-linework). It has been updated to use this package.
The Project Linework shapefiles also work well [with Leaflet](http://rpubs.com/hrbrmstr/linework-leaflet).
The following functions are implemented:
- `lineworks` : Return vector of available linework shapes and optionally print verbose description of shapfile data elements.
- `linework_map` : Retrieve a linework map as a regular or fortified `SpatialPolygonsDataFrame`The following data sets are included:
- `linework` : Project Linework spatial & fortified objects
### News
- Version 0.0.1.9001 : naming consistency
- Version 0.0.1.9000 : Added two new Project Linework map sets: Moriarty Hand and Weekend Update [[ref](http://www.projectlinework.org/2015/08/31/new_linework_sets.html)]
- Version 0.0.0.9000 released### Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/lineworkmaps")
``````{r echo=FALSE, message=FALSE, warning=FALSE, error=FALSE}
options(width=120)
```### Usage
```{r}
library(lineworkmaps)
library(sp)
library(ggplot2)
library(ggthemes)# current verison
packageVersion("lineworkmaps")# plot admin1 polygons for Elmer Casual (the defaults)
plot(linework_map())# plot the continental United States "Wargames" style
wargames <- linework_map("wargames", fortified=TRUE)us <- wargames[wargames$iso_a2=="US" &
!wargames$code_hasc %in% c("US.HI", "US.AK"),]ggplot(us) +
geom_map(map=us, aes(x=long, y=lat, map_id=id)) +
coord_map(project="albers", lat0=37.5, lat1=29.5) +
theme_map()# fancier example just focusing on the U.S.
elmer <- linework_map("elmer_casual", fortified=TRUE)us <- elmer[elmer$COUNTRY=="US" &
elmer$Name != "Alaska",]gg <- ggplot()
gg <- gg + geom_map(data=us, map=us,
aes(x=long, y=lat, map_id=id),
color="#939598", fill="#d1d2d4", size=0.5)
gg <- gg + coord_map(project="albers", lat0=37.5, lat1=29.5)
gg <- gg + labs(title="Elmer Casual")
gg <- gg + theme_map()
gg <- gg + theme(plot.title=element_text(size=16))
gg# new maps: moriarty hand & weekend update
moriarty <- linework_map("moriarty_hand", fortified=TRUE)
us <- moriarty[substring(moriarty$ISO_3166_2, 1, 2) =="US" &
!(moriarty$ISO_3166_2 %in% c("US-AK", "US-HI")),]gg <- ggplot()
gg <- gg + geom_map(data=us, map=us,
aes(x=long, y=lat, map_id=id),
color="#939598", fill="#d1d2d4", size=0.5)
gg <- gg + coord_map(project="albers", lat0=37.5, lat1=29.5)
gg <- gg + labs(title="Moriarty Hand Admin 1 CONUS")
gg <- gg + theme_map()
gg <- gg + theme(plot.title=element_text(size=16))
ggmoriarty <- linework_map("moriarty_hand", admin_level=0, fortified=FALSE)
moriarty <- subset(moriarty, region_un=="Africa")
moriarty <- fortify(moriarty)gg <- ggplot()
gg <- gg + geom_map(data=moriarty, map=moriarty,
aes(x=long, y=lat, map_id=id),
color="#939598", fill="#d1d2d4", size=0.5)
gg <- gg + coord_quickmap()
gg <- gg + labs(title="Moriarty Hand Admin 0 - Africa")
gg <- gg + theme_map()
gg <- gg + theme(plot.title=element_text(size=16))
ggweekend <- linework_map("weekend_update", admin_level=0, fortified=TRUE)
weekend <- subset(weekend, Country != "United States")gg <- ggplot()
gg <- gg + geom_map(data=weekend, map=weekend,
aes(x=long, y=lat, map_id=id),
color="#939598", fill="#d1d2d4", size=0.5)
gg <- gg + coord_quickmap()
gg <- gg + labs(title="Weekend Update - Europe")
gg <- gg + theme_map()
gg <- gg + theme(plot.title=element_text(size=16))
gg# info about the lineworks
lineworks(verbose=TRUE)
```### Test Results
```{r}
library(lineworkmaps)
library(testthat)date()
test_dir("tests/")
```### Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.