You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.7 KiB

8 years ago
---
output: rmarkdown::github_document
8 years ago
---
4 years ago
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```
6 years ago
4 years ago
```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges()
```
6 years ago
4 years ago
```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```
4 years ago
6 years ago
## What's Inside The Tin
The following functions are implemented:
4 years ago
- `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 simplefeature
New ones:
- `points_elided`: Shift points around Alaska and Hawaii to the elided area (by @rdinter)
7 years ago
Some legacy ones:
4 years ago
- `usa_composite`: Retrieve a U.S. composite map, optionally with a projection
- `counties_composite`: Retrieve a U.S. county composite map, optionally with a projection
7 years ago
Pre-canned projection strings:
8 years ago
- `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 projection
The 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")`
4 years ago
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).
8 years ago
6 years ago
## Installation
4 years ago
```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```
6 years ago
## Usage
8 years ago
```{r message=FALSE, fig.retina=2}
library(albersusa)
library(sf)
8 years ago
library(sp)
library(rgeos)
library(maptools)
library(ggplot2)
library(ggalt)
library(ggthemes)
library(viridis)
library(scales)
4 years ago
# current version
packageVersion("albersusa")
```
4 years ago
### 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"])
```
4 years ago
### ggplot2
```{r message=FALSE, warning=FALSE, fig.retina=2}
4 years ago
ggplot() +
geom_sf(data = us_sf, size = 0.125)
8 years ago
4 years ago
ggplot() +
geom_sf(data = us_sf, size = 0.125) +
coord_sf(crs = us_longlat_proj)
8 years ago
4 years ago
ggplot() +
geom_sf(data = cty_sf, size = 0.0725)
8 years ago
4 years ago
ggplot() +
geom_sf(data = cty_sf, size = 0.0725) +
coord_sf(crs = us_longlat_proj)
```
4 years ago
## albersusa Metrics
4 years ago
```{r cloc, echo=FALSE}
cloc::cloc_pkg_md()
6 years ago
```
6 years ago
## Code of Conduct
4 years ago
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.