Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to fix erase_water() #172 + #151 + #184 + improve error checking w/ rlang #173

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
5b29648
docs: apply markdown formatting
elipousson Aug 4, 2023
463adc2
Swap 2020 year defaults for 2021
elipousson Aug 4, 2023
82e611d
Fix issue w/ `erase_water()` #172
elipousson Aug 4, 2023
0bde5d5
Add `is_sf()` helper to `shift_geometry()`
elipousson Aug 4, 2023
689686f
Expose cb parameter + format docs
elipousson Aug 12, 2023
652bcb9
Consolidate input checks in utility functions
elipousson Aug 13, 2023
f625cc6
Merge branch 'master' into master
elipousson Sep 28, 2023
43cc37f
Add `url_tiger()` internal helper function
elipousson Oct 21, 2023
eeeb146
Add support for `sfc` filter_by inputs
elipousson Oct 21, 2023
84bcce2
Update `congressional_districts` to match updates to main
elipousson Mar 7, 2024
e2993f8
Update default year to match main
elipousson Mar 7, 2024
40326ae
Tidy DESCRIPTION
elipousson Mar 7, 2024
e41fcff
Update docs
elipousson Mar 7, 2024
b243934
Use cli formatting for rlang messages
elipousson Mar 7, 2024
24fd602
Add `check_cb_year` helper function
elipousson Mar 8, 2024
4132504
Incorporate abort, warn, + inform from rlang
elipousson Mar 8, 2024
359e457
Drop stringr from Imports
elipousson Mar 8, 2024
b3fb4d8
Remove prefixing for tigris functions
elipousson Mar 8, 2024
754ebc2
Fix #184
elipousson Mar 8, 2024
cd4aaa1
Fix #151
elipousson Mar 8, 2024
6722dee
Minor refactor for congressional_districts + state_legislative_districts
elipousson Mar 8, 2024
7caa7a2
Ignore case for resolution
elipousson Mar 8, 2024
0c1f5b2
Fix minimum year for state_legislative_districts
elipousson Mar 8, 2024
8cf415c
Add require_state + require_county parameters
elipousson Mar 8, 2024
cdc654d
Add tests for errors + working functions
elipousson Mar 8, 2024
0376160
Merge branch 'master' into master
elipousson Mar 8, 2024
fa54f0a
Set state/county validation to abort not warn
elipousson Mar 9, 2024
5505607
Expand tests
elipousson Mar 9, 2024
4168f9d
Merge branch 'master' of https://github.com/elipousson/tigris
elipousson Mar 9, 2024
29a793d
Fix duplicate code introduced when resolving merge conflict
elipousson Mar 9, 2024
4559e44
Improve county validation in voting_districts
elipousson Mar 12, 2024
098e9f4
Add rename_fips_cols helper function
elipousson Mar 12, 2024
6ae8a0a
Drop un-needed as.character
elipousson Mar 12, 2024
43b0335
Expand enumeration_units tests
elipousson Mar 12, 2024
6b6b0a8
Add tests for pumas
elipousson Mar 12, 2024
7c142d9
Add test for states + tests for metro areas
elipousson Mar 12, 2024
1c63c60
Add check for length > 1 filter_by inputs
elipousson Mar 20, 2024
84753a1
Add `get_tigris_cache_dir` helper + `check_tigris_url` helper
elipousson Mar 20, 2024
31e39b0
Fix merge conflicts w/ main
elipousson Mar 28, 2024
f6bad02
Update default + max years for metro area functions
elipousson Apr 10, 2024
0d68d2d
Correct min_year for states + counties
elipousson Apr 10, 2024
fdf9fea
Correct handling for 2010 congressional districts
elipousson Apr 10, 2024
0f41d25
Restore disabled tests
elipousson Apr 10, 2024
315d46f
Add support for 2000 places per #129
elipousson Apr 10, 2024
1801c14
Add support for year = 200 when cb = TRUE
elipousson Apr 10, 2024
330ff4b
Expand enumeration unit tests
elipousson Apr 10, 2024
25c84c9
Fix minor bug w/ validate_county
elipousson Apr 10, 2024
75bd2a1
Swap check_tigris_year for check_not_year
elipousson Apr 10, 2024
8b8ecf9
Minor message clean-up
elipousson Apr 10, 2024
d645a48
Add multiple parameter to validate_county
elipousson Apr 10, 2024
fd768f0
Update min_year for functions w/ data available in 2010
elipousson Apr 16, 2024
12b0401
Additional validation clean-up
elipousson Apr 16, 2024
6023862
Add year_suf helper
elipousson Apr 17, 2024
372bd7c
Expand 2000 and 2010 support for native geographies
elipousson Apr 17, 2024
0810dbc
No docs for year_suf
elipousson Apr 17, 2024
72a7ab9
Improve error message for `places()`
elipousson Apr 17, 2024
d988ce8
Use year_suf helper consistently
elipousson Apr 17, 2024
2128747
Add NEWS
elipousson Apr 17, 2024
9537f0f
Clean-up line break issues in docs
elipousson Apr 17, 2024
17af59c
Fix regression in state
elipousson Apr 17, 2024
7f6ac66
Fix list_states handling of sf objects
elipousson Apr 17, 2024
7de2b4c
Add snapshot tests for states
elipousson Apr 17, 2024
4762366
Add geocode test
elipousson Apr 17, 2024
c0f9a48
list_states should only support sf not sp objects
elipousson Apr 17, 2024
4363bc8
Fix typo for alaska_native_regional_corporations
elipousson Apr 17, 2024
7db59da
Fix typo for tribal block groups and tracts
elipousson Apr 17, 2024
ec5755a
Fix county validation for voting districts
elipousson Apr 17, 2024
91a46f8
Fix bug w/ core_based_statistical_areas when year = 2010
elipousson Apr 17, 2024
a68b653
Expand tests
elipousson Apr 17, 2024
b722944
Split prep_input_sfc from input_to_wkt
elipousson Apr 30, 2024
68e8cee
Separate out st_erase helper
elipousson Apr 30, 2024
640bceb
Fix deprecated usage of .data
elipousson May 14, 2024
94fcd23
Clean up issues flagged by lintr
elipousson May 14, 2024
8a3c1a7
Fix duplication in fips_codes docs
elipousson May 14, 2024
ba4f33e
Update docs
elipousson May 14, 2024
311eddc
Style tests
elipousson May 14, 2024
1da03ab
Expand tests of geocode + enumeration units
elipousson May 14, 2024
dc687a8
Improve state and county validation
elipousson May 21, 2024
5c7e3cb
Export internal county + state validation functions (#136)
elipousson May 21, 2024
606f9f3
Fix issue w/ missing multiple arg for check_tigris_arg
elipousson May 21, 2024
9dc464c
Export validation functions (#136)
elipousson May 26, 2024
e0b267b
Add crs and query parameters to `load_tiger()`
elipousson May 26, 2024
8556ad4
Switch README from markdown to Rmd
elipousson May 26, 2024
d7032f6
Add warning if state is invalid but return all
elipousson Sep 23, 2024
59054b6
Add prefixes to import from sf
elipousson Sep 23, 2024
d3c31c9
Fix typo in returns description
elipousson Sep 23, 2024
4580788
Add inherits_Spatial + check_not_Spatial
elipousson Sep 23, 2024
6121fbb
Use st_is_all_valid helper
elipousson Sep 23, 2024
02bf330
Use option allowing county/state validation when multiple = TRUE
elipousson Sep 23, 2024
363380d
Avoid importing full sf package
elipousson Sep 23, 2024
6ee0dcc
Update README
elipousson Sep 23, 2024
6cab508
Expand tests
elipousson Sep 23, 2024
2a9ac70
Update docs
elipousson Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
^img$

^\.github$
^README\.Rmd$
55 changes: 29 additions & 26 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
Package: tigris
Type: Package
Package: tigris
Title: Load Census TIGER/Line Shapefiles
Version: 2.0.6
Date: 2024-01-23
Version: 2.1.1
Date: 2024-03-26
Authors@R: c(
person(given="Kyle", family="Walker", email="[email protected]", role=c("aut", "cre")),
person(given="Bob", family="Rudis", email="[email protected]", role="ctb")
)
URL: https://github.com/walkerke/tigris
BugReports: https://github.com/walkerke/tigris/issues
Description: Download TIGER/Line shapefiles from the United States Census Bureau
(<https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html>)
person("Kyle", "Walker", , "[email protected]", role = c("aut", "cre")),
person("Bob", "Rudis", , "[email protected]", role = "ctb"),
person("Eli", "Pousson", , "[email protected]", role = "ctb")
)
Description: Download TIGER/Line shapefiles from the United States Census
Bureau
(<https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html>)
and load into R as 'sf' objects.
License: MIT + file LICENSE
LazyData: TRUE
Encoding: UTF-8
URL: https://github.com/walkerke/tigris
BugReports: https://github.com/walkerke/tigris/issues
Depends:
R (>= 3.3.0)
Imports:
dplyr,
httr,
magrittr,
methods,
rappdirs,
rlang,
sf,
utils
Suggests:
testthat,
ggplot2,
ggthemes,
knitr,
leaflet,
knitr,
sp,
testthat (>= 3.0.0),
tidycensus,
sp
Imports:
stringr,
magrittr,
utils,
rappdirs,
httr,
uuid,
sf,
dplyr,
methods
RoxygenNote: 7.2.3
withr
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: TRUE
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
33 changes: 28 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,42 @@ export(tribal_block_groups)
export(tribal_census_tracts)
export(tribal_subdivisions_national)
export(urban_areas)
export(validate_county)
export(validate_state)
export(voting_districts)
export(zctas)
import(dplyr)
import(httr)
import(rappdirs)
import(sf)
import(rlang)
import(utils)
import(uuid)
importFrom(dplyr,mutate)
importFrom(httr,GET)
importFrom(httr,HEAD)
importFrom(httr,http_error)
importFrom(httr,progress)
importFrom(httr,stop_for_status)
importFrom(httr,write_disk)
importFrom(magrittr,"%>%")
importFrom(methods,as)
importFrom(stringr,str_pad)
importFrom(stringr,str_trim)
importFrom(rappdirs,user_cache_dir)
importFrom(sf,as_Spatial)
importFrom(sf,st_as_sf)
importFrom(sf,st_as_sfc)
importFrom(sf,st_as_text)
importFrom(sf,st_bbox)
importFrom(sf,st_cast)
importFrom(sf,st_centroid)
importFrom(sf,st_crs)
importFrom(sf,st_difference)
importFrom(sf,st_geometry)
importFrom(sf,st_geometry_type)
importFrom(sf,st_intersection)
importFrom(sf,st_intersects)
importFrom(sf,st_is_valid)
importFrom(sf,st_make_valid)
importFrom(sf,st_point)
importFrom(sf,st_read)
importFrom(sf,st_sfc)
importFrom(sf,st_transform)
importFrom(sf,st_union)
importFrom(utils,URLencode)
41 changes: 41 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
tigris (development)
-------------------------------------------------------

### New features

* Functions in tigris now default to a year of 2022.

New support for downloading multiple existing or new datasets:

* 2022 or 2023 (118th Congress) data for `congressional_districts()` (#180)

* 2010 data for `area_water()`, `linear_water()`, `roads()`, `primary_roads()`, `primary_secondary_roads()`, `rails()`, `military()`, `landmarks()`, `tribal_block_groups()` and `tribal_census_tracts()`.

* 2000 and 2010 data for `places()` (#129), `native_areas()`, `tribal_subdivisions_national()`, and `alaska_native_regional_corporations()`.

Improved input validation both for specific functions and in general:

* All functions use consistent validation for `year`, `state`, and `county` parameters. If state or county is required, functions error (instead of warning) for `NULL` or invalid values.

* Error when `year = 2022` for `combined_statistical_areas()` and `core_based_statistical_areas()`. (#184)

* Error if URL does not exist (rather than retrying download). (#185)

* Warn users when `filter_by` contains multiple geometries and only part of the filter can be used.

### Bug fixes

* `erase_water()` will not fail when `input_sf` doesn't intersect with any water areas. (#172, #182)

### Internal changes

* Remove `{stringr}` and `{uuid}` from Imports and add `{rlang}`

* Add `{withr}` to Suggests (for tests only).

* Switch to use `rlang::abort()`, `rlang::warn()` and `rlang::inform()` for all errors, warnings, and messages.

* Add `multiple` argument to `validate_state()` and `validate_county()` to allow validation of multiple states or counties in a single call. Export both validation functions as internal functions.

* Refactor and add helper functions (`set_tigris_year()`, `check_tigris_year()`, and `url_tiger()`) to reduce duplication and make code more maintainable.

tigris 2.0
-------------------------------------------------------
* A new filter_by argument allows users to subset datasets by a bounding box or another sf object when requesting data.
Expand Down
Loading