Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrbrmstr/albersusa
Tools, shapefiles & data to work with an "AlbersUSA" composite projection in R
https://github.com/hrbrmstr/albersusa
albersusa cartograms cartography map-projections r rstats
Last synced: 3 months ago
JSON representation
Tools, shapefiles & data to work with an "AlbersUSA" composite projection in R
- Host: GitHub
- URL: https://github.com/hrbrmstr/albersusa
- Owner: hrbrmstr
- License: other
- Archived: true
- Created: 2016-03-28T19:12:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T20:51:49.000Z (over 4 years ago)
- Last Synced: 2024-06-11T11:47:03.370Z (5 months ago)
- Topics: albersusa, cartograms, cartography, map-projections, r, rstats
- Language: R
- Size: 31.8 MB
- Stars: 77
- Watchers: 10
- Forks: 16
- Open Issues: 18
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - hrbrmstr/albersusa - Tools, shapefiles & data to work with an "AlbersUSA" composite projection in R (R)
README
---
output: rmarkdown::github_document
---
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
``````{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
``````{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```## What's Inside The Tin
The following functions are implemented:
- `counties_sf`: Retrieve a U.S. county composite map, optionally with a projection, as a simplefeature
- `usa_sf`: Retreive a U.S. state composite map, optionally with a projection, as a simplefeatureNew ones:
- `points_elided`: Shift points around Alaska and Hawaii to the elided area (by @rdinter)
Some legacy ones:
- `usa_composite`: Retrieve a U.S. composite map, optionally with a projection
- `counties_composite`: Retrieve a U.S. county composite map, optionally with a projectionPre-canned projection strings:
- `us_aeqd_proj`: Oblique azimuthal equidistant convenience projection
- `us_eqdc_proj`: Equidistant conic convenience projection
- `us_laea_proj`: Albers equal-area conic convenience projection
- `us_lcc_proj`: Lambert conformal conic convenience projection
- `us_longlat_proj`: Generic long/lat convenience projectionThe following data sets are included:
- `system.file("extdata/composite_us_states.geojson.gz", package="albersusa")`
- `system.file("extdata/composite_us_counties.geojson.gz", package="albersusa")`Also, the simplefeatures columns and `@data` slot of each `SpatialPolygonsDataFrame` has some handy data you can use (like FIPS codes and state/county population information).
## Installation
```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```## Usage
```{r message=FALSE, fig.retina=2}
library(albersusa)
library(sf)
library(sp)
library(rgeos)
library(maptools)
library(ggplot2)
library(ggalt)
library(ggthemes)
library(viridis)
library(scales)# current version
packageVersion("albersusa")
```### Simple features base
```{r message=FALSE, fig.retina=2}
par(mar=c(0,0,1,0))us_sf <- usa_sf("laea")
plot(us_sf["pop_2012"])cty_sf <- counties_sf("aeqd")
plot(cty_sf["census_area"])
```### ggplot2
```{r message=FALSE, warning=FALSE, fig.retina=2}
ggplot() +
geom_sf(data = us_sf, size = 0.125)ggplot() +
geom_sf(data = us_sf, size = 0.125) +
coord_sf(crs = us_longlat_proj)ggplot() +
geom_sf(data = cty_sf, size = 0.0725)ggplot() +
geom_sf(data = cty_sf, size = 0.0725) +
coord_sf(crs = us_longlat_proj)
```## albersusa Metrics
```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
```## 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.