Skip to content

Commit 6e15332

Browse files
committed
updated vignette with new data
1 parent 21f5a79 commit 6e15332

20 files changed

+257
-100
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
^CRAN-RELEASE$
1717
^[.]?air[.]toml$
1818
^codemeta.json$
19+
^doc$
20+
^Meta$

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
.Rhistory
33
.RData
44
.Ruserdata
5+
inst/doc
6+
/doc/
7+
/Meta/

R/state_codes.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#' }
1313
#'
1414
#' @references U.S. Census Bureau,
15-
#' \href{https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.2014.html}{U.S. Gazeteer Files} (2014).
15+
#' \href{https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.2024.html}{U.S. Gazeteer Files} (2024).
1616
#'
17-
#' \href{https://en.wikipedia.org/wiki/Federal_Information_Processing_Standard_state_code}{Federal Information Processing Standard state code}, Wikipedia (accessed July 23,
18-
#' 2015).
17+
#' \href{https://en.wikipedia.org/wiki/Federal_Information_Processing_Standard_state_code}{Federal Information Processing Standard state code}, Wikipedia (accessed October 12,
18+
#' 2025).
1919
"state_codes"

R/us_cities.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#'
3030
#' @export
3131
us_cities <- function(map_date = NULL, states = NULL) {
32+
# TODO maybe return all the cities to see trend over time?
3233
if (is.null(map_date)) {
3334
message("City populations for contemporary data come from the 2010 census.")
3435
map_date <- 2010

R/us_counties.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ us_counties <- function(
7272
shp <- filter_by_states(shp, states)
7373
} else {
7474
map_date <- as.Date(map_date)
75+
# TODO better error message?
7576
stopifnot(
7677
as.Date("1636-12-30") <= map_date,
7778
map_date <= as.Date("2000-12-31")

R/us_states.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' State boundaries (contemporary and historical)
22
#'
3-
#' Get the current (2024) boundaries for U.S states from the U.S. Census Bureau,
3+
#' Get the current (2019) boundaries for U.S states from the U.S. Census Bureau,
44
#' or get historical state boundaries for dates between 3 September 1783 and 31
55
#' December 2000.
66
#'

R/usaboundaries-package.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#' USAboundaries: Historical and Contemporary Boundaries of the United States of
2+
#' America
3+
#'
4+
#' This package provides contemporary (2014) boundaries for states, counties,
5+
#' zip code tabulation areas, and congressional districts in the United States
6+
#' of America. This data is provided by the U.S. Census Bureau.
7+
#'
8+
#' This package also provides spatial objects with historical boundaries of
9+
#' states or counties in the United States of America from 1629 to 2000. It
10+
#' provides data from the \href{https://publications.newberry.org/ahcbp/}{Atlas
11+
#' of Historical County Boundaries}. The copyright to the historical data used
12+
#' in this package is owned by the Newberry Library, and it is included in the
13+
#' \code{USAboundariesData} package under the terms of the
14+
#' \href{https://creativecommons.org/licenses/by-nc-sa/2.5/}{Creative Commons
15+
#' Attribution-NonCommercial-ShareAlike 2.5 Generic} (CC BY-NC-SA 2.5) license.
16+
#'
17+
#' The code in this package is copyrighted by
18+
#' \href{https://lincolnmullen.com}{Lincoln Mullen}, and is released under the
19+
#' terms of the \href{https://opensource.org/licenses/MIT}{MIT License}.
20+
#'
21+
#' @name USAboundaries
22+
NULL
23+
24+
if (getRversion() >= "2.15.1") {
25+
utils::globalVariables(c("state_codes", "state_proj"))
26+
}

R/usboundaries-package.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' USAboundaries: Historical and Contemporary Boundaries of the United States of
22
#' America
33
#'
4-
#' This package provides contemporary (2014) boundaries for states, counties,
4+
#' This package provides contemporary (2024) boundaries for states, counties,
55
#' zip code tabulation areas, and congressional districts in the United States
66
#' of America. This data is provided by the U.S. Census Bureau.
77
#'

README.Rmd

Lines changed: 89 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
output: github_document
33
pagetitle: Historical and Contemporary Boundaries of the United States of America
4+
editor_options:
5+
markdown:
6+
wrap: 72
47
---
58

69
<!-- README.md is generated from README.Rmd. Please edit that file -->
@@ -17,38 +20,47 @@ set.seed(87737)
1720
# USAboundaries
1821

1922
<!-- [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/USAboundaries)](https://cran.r-project.org/package=USAboundaries) -->
20-
[![JOSS Status](https://joss.theoj.org/papers/3458a33133aa6c069ab4dd8df0b5f3b5/status.svg)](https://doi.org/10.21105/joss.00314)
23+
24+
[![JOSS
25+
Status](https://joss.theoj.org/papers/3458a33133aa6c069ab4dd8df0b5f3b5/status.svg)](https://doi.org/10.21105/joss.00314)
2126
[![R-CMD-check](https://github.com/ropensci/USAboundaries/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/USAboundaries/actions/workflows/R-CMD-check.yaml)
22-
[![Codecov test coverage](https://codecov.io/gh/ropensci/USAboundaries/graph/badge.svg)](https://app.codecov.io/gh/ropensci/USAboundaries)
27+
[![Codecov test
28+
coverage](https://codecov.io/gh/ropensci/USAboundaries/graph/badge.svg)](https://app.codecov.io/gh/ropensci/USAboundaries)
2329
![r-universe](https://ropensci.r-universe.dev/USAboundaries/badges/version)
2430

25-
2631
## Overview
2732

28-
This R package includes contemporary state, county, and Congressional district
29-
boundaries, as well as zip code tabulation area centroids. It also includes
30-
historical boundaries from 1629 to 2000 for states and counties from the
31-
Newberry Library's [Atlas of Historical County
32-
Boundaries](https://publications.newberry.org/ahcbp/), as well as historical
33+
Note: Due to U.S. Government Shutdown, state boundaries are unable to be
34+
updated.
35+
36+
This R package includes contemporary state, county, and Congressional
37+
district boundaries, and zip code tabulation area centroids. It also
38+
includes historical boundaries from 1629 to 2000 for states and counties
39+
from the Newberry Library's [Atlas of Historical County
40+
Boundaries](https://publications.newberry.org/ahcbp/) and historical
3341
city population data from Erik Steiner's "[United States Historical City
3442
Populations,
3543
1790-2010](https://github.com/cestastanford/historical-us-city-populations)."
36-
The package has some helper data, including a table of state names,
37-
abbreviations, and FIPS codes, and functions and data to get [State Plane
38-
Coordinate System](https://en.wikipedia.org/wiki/State_Plane_Coordinate_System)
3944

45+
The package has some helper data, including a table of state names,
46+
abbreviations, and FIPS codes, and functions and data to get [State
47+
Plane Coordinate
48+
System](https://en.wikipedia.org/wiki/State_Plane_Coordinate_System)
4049
projections as EPSG codes or PROJ.4 strings.
41-
This package can serve a number of purposes. The spatial data can be joined to
42-
any other kind of data in order to make thematic maps. Unlike other R packages,
43-
this package also contains historical data for use in analyses of the recent or
44-
more distant past. See the ["A sample analysis using
50+
51+
This package can serve a number of purposes. The spatial data can be
52+
joined to any other kind of data in order to make thematic maps. Unlike
53+
other R packages, this package also contains historical data for use in
54+
analyses of the recent or more distant past. See the ["A sample analysis
55+
using
4556
USAboundaries"](https://docs.ropensci.org/USAboundaries/articles/usaboundaries-sample-analysis.html)
46-
vignette for an example of how the package can be used for both historical and
47-
contemporary maps.
57+
vignette for an example of how the package can be used for both
58+
historical and contemporary maps.
4859

4960
## Citation
5061

51-
If you use this package in your research, we would appreciate a citation.
62+
If you use this package in your research, we would appreciate a
63+
citation.
5264

5365
```{r}
5466
citation("USAboundaries")
@@ -58,41 +70,45 @@ citation("USAboundaries")
5870

5971
You can install this package from CRAN.
6072

61-
```
73+
```
6274
install.packages("USAboundaries", repos = c("https://ropensci.r-universe.dev"))
6375
```
6476

65-
Almost all of the data for this package is provided by the [USAboundariesData
66-
package](https://github.com/ropensci/USAboundariesData). That package will be
67-
automatically installed (with your permission) from the [rOpenSci package
68-
repository](https://ropensci.r-universe.dev) the first time that you need it.
77+
Almost all of the data for this package is provided by the
78+
[USAboundariesData
79+
package](https://github.com/ropensci/USAboundariesData). That package
80+
will be automatically installed (with your permission) from the
81+
[rOpenSci package repository](https://ropensci.r-universe.dev) the first
82+
time that you need it.
6983

7084
Or you can install the development versions from GitHub:
7185

72-
```
86+
```
7387
install.packages("USAboundaries", repos = c("https://ropensci.r-universe.dev"))
7488
install.packages("USAboundariesData", repos = c("https://ropensci.r-universe.dev"))
7589
```
7690

7791
## Use
7892

7993
This package provides a set of functions, one for each of the types of
80-
boundaries that are available. These functions have a consistent interface.
94+
boundaries that are available. These functions have a consistent
95+
interface.
8196

82-
Passing a date to `us_states()`, `us_counties()`, and `us_cities()` returns the
83-
historical boundaries for that date. If no date argument is passed, then
84-
contemporary boundaries are returned. The functions `us_congressional()` and
85-
`us_zipcodes()` only offer contemporary boundaries.
97+
Passing a date to `us_states()`, `us_counties()`, and `us_cities()`
98+
returns the historical boundaries for that date. If no date argument is
99+
passed, then contemporary boundaries are returned. The functions
100+
`us_congressional()` and `us_zipcodes()` only offer contemporary
101+
boundaries.
86102

87103
For almost all functions, pass a character vector of state names or
88104
abbreviations to the `states =` argument to return only those states or
89105
territories.
90106

91-
For certain functions, more or less detailed boundary information is available
92-
by passing an argument to the `resolution =` argument.
107+
For certain functions, more or less detailed boundary information is
108+
available by passing an argument to the `resolution =` argument.
93109

94-
See the examples below to see how the interface works, and see the documentation
95-
for each function for more details.
110+
See the examples below to see how the interface works, and see the
111+
documentation for each function for more details.
96112

97113
```{r}
98114
library(USAboundaries)
@@ -125,9 +141,9 @@ title("Congressional district boundaries in California")
125141

126142
## State plane projections
127143

128-
The `state_plane()` function returns EPSG codes and PROJ.4 strings for the State
129-
Plane Coordinate System. You can use these to use suitable projections for
130-
specific states.
144+
The `state_plane()` function returns EPSG codes and PROJ.4 strings for
145+
the State Plane Coordinate System. You can use these to use suitable
146+
projections for specific states.
131147

132148
```{r}
133149
va <- us_states(states = "VA", resolution = "high")
@@ -141,33 +157,49 @@ plot(st_geometry(va), graticule = TRUE)
141157
## Related packages
142158

143159
Each function returns an `sf` object from the
144-
[sf](https://cran.r-project.org/package=sf) package, which can be mapped using
145-
the [leaflet](https://cran.r-project.org/package=leaflet) or
160+
[sf](https://cran.r-project.org/package=sf) package, which can be mapped
161+
using the [leaflet](https://cran.r-project.org/package=leaflet) or
146162
[ggplot2](https://cran.r-project.org/package=ggplot2) packages.
147163

148-
If you need U.S. Census Bureau boundary files which are not provided by this
149-
package, consider using the [tigris](https://cran.r-project.org/package=tigris)
150-
package, which downloads those shapefiles.
164+
If you need U.S. Census Bureau boundary files not provided by this
165+
package, consider using the
166+
[tigris](https://cran.r-project.org/package=tigris) package, which
167+
downloads those shapefiles.
151168

152-
## License
169+
USAboundaries differs from tigris in a few ways:
170+
171+
- Boundary files are contained within the data package while tigris
172+
downloads the files from US Census.
153173

154-
The historical boundary data provided in this package is available under the CC
155-
BY-NC-SA 2.5 license from John H. Long, et al., [Atlas of Historical County
156-
Boundaries](https://publications.newberry.org/ahcbp/), Dr. William M. Scholl
157-
Center for American History and Culture, The Newberry Library, Chicago (2010).
158-
Please cite that project if you use this package in your research and abide by
159-
the terms of their license if you use the historical information.
174+
- USAboundaries uses Cartographic Boundary Files (CBFs) that are
175+
simplified representations of TIGER/Line shapefiles. They are much
176+
smaller in file size, making rendering much faster on the screen.
160177

161-
The historical population data for cities is provided by U.S. Census Bureau and
162-
Erik Steiner, Spatial History Project, Center for Spatial and Textual Analysis,
163-
Stanford University. See the data in [this
178+
- Data files contain historical boundary and population data dating as
179+
far back as 1629.
180+
181+
## License
182+
183+
The historical boundary data provided in this package is available under
184+
the CC BY-NC-SA 2.5 license from John H. Long, et al., [Atlas of
185+
Historical County Boundaries](https://publications.newberry.org/ahcbp/),
186+
Dr. William M. Scholl Center for American History and Culture, The
187+
Newberry Library, Chicago (2010). Please cite that project if you use
188+
this package in your research and abide by the terms of their license if
189+
you use the historical information.
190+
191+
The historical population data for cities is provided by U.S. Census
192+
Bureau and Erik Steiner, Spatial History Project, Center for Spatial and
193+
Textual Analysis, Stanford University. See the data in [this
164194
repository](https://github.com/cestastanford/historical-us-city-populations).
165195

166-
The contemporary data is provided by the U.S. Census Bureau and is in the public
167-
domain.
196+
The contemporary data is provided by the U.S. Census Bureau and is in
197+
the public domain.
168198

169-
All code in this package is copyright [Lincoln Mullen](http://lincolnmullen.com)
170-
and is released under the MIT license.
199+
All code in this package is copyright [Lincoln
200+
Mullen](http://lincolnmullen.com) and is released under the MIT license.
171201

172-
---
173-
[![rOpenSci footer](https://ropensci.org//public_images/github_footer.png)](https://ropensci.org/)
202+
------------------------------------------------------------------------
203+
204+
[![rOpenSci
205+
footer](https://ropensci.org//public_images/github_footer.png)](https://ropensci.org/)

README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,29 @@ coverage](https://codecov.io/gh/ropensci/USAboundaries/graph/badge.svg)](https:/
1414

1515
## Overview
1616

17+
Note: Due to U.S. Government Shutdown, state boundaries are unable to be
18+
updated.
19+
1720
This R package includes contemporary state, county, and Congressional
18-
district boundaries, as well as zip code tabulation area centroids. It
19-
also includes historical boundaries from 1629 to 2000 for states and
20-
counties from the Newberry Library’s [Atlas of Historical County
21-
Boundaries](https://publications.newberry.org/ahcbp/), as well as
22-
historical city population data from Erik Steiner’s “[United States
23-
Historical City Populations,
21+
district boundaries, and zip code tabulation area centroids. It also
22+
includes historical boundaries from 1629 to 2000 for states and counties
23+
from the Newberry Library’s [Atlas of Historical County
24+
Boundaries](https://publications.newberry.org/ahcbp/) and historical
25+
city population data from Erik Steiner’s “[United States Historical City
26+
Populations,
2427
1790-2010](https://github.com/cestastanford/historical-us-city-populations).”
28+
2529
The package has some helper data, including a table of state names,
2630
abbreviations, and FIPS codes, and functions and data to get [State
2731
Plane Coordinate
2832
System](https://en.wikipedia.org/wiki/State_Plane_Coordinate_System)
33+
projections as EPSG codes or PROJ.4 strings.
2934

30-
projections as EPSG codes or PROJ.4 strings. This package can serve a
31-
number of purposes. The spatial data can be joined to any other kind of
32-
data in order to make thematic maps. Unlike other R packages, this
33-
package also contains historical data for use in analyses of the recent
34-
or more distant past. See the [“A sample analysis using
35+
This package can serve a number of purposes. The spatial data can be
36+
joined to any other kind of data in order to make thematic maps. Unlike
37+
other R packages, this package also contains historical data for use in
38+
analyses of the recent or more distant past. See the [“A sample analysis
39+
using
3540
USAboundaries”](https://docs.ropensci.org/USAboundaries/articles/usaboundaries-sample-analysis.html)
3641
vignette for an example of how the package can be used for both
3742
historical and contemporary maps.
@@ -193,11 +198,23 @@ Each function returns an `sf` object from the
193198
using the [leaflet](https://cran.r-project.org/package=leaflet) or
194199
[ggplot2](https://cran.r-project.org/package=ggplot2) packages.
195200

196-
If you need U.S. Census Bureau boundary files which are not provided by
197-
this package, consider using the
201+
If you need U.S. Census Bureau boundary files not provided by this
202+
package, consider using the
198203
[tigris](https://cran.r-project.org/package=tigris) package, which
199204
downloads those shapefiles.
200205

206+
USAboundaries differs from tigris in a few ways:
207+
208+
- Boundary files are contained within the data package while tigris
209+
downloads the files from US Census.
210+
211+
- USAboundaries uses Cartographic Boundary Files (CBFs) that are
212+
simplified representations of TIGER/Line shapefiles. They are much
213+
smaller in file size, making rendering much faster on the screen.
214+
215+
- Data files contain historical boundary and population data dating as
216+
far back as 1629.
217+
201218
## License
202219

203220
The historical boundary data provided in this package is available under

0 commit comments

Comments
 (0)