Skip to content

Commit 6db8fe2

Browse files
Updated documentation.
1 parent 75ebaa7 commit 6db8fe2

File tree

7 files changed

+51
-20
lines changed

7 files changed

+51
-20
lines changed

Diff for: R/data.R

+11-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,22 @@
3434
#' @source \url{https://www.worldclim.org/data/worldclim21.html}
3535
"WorldClim_annual_gdd"
3636

37-
#' Southwestern United States and Mexico States Polygon
37+
#' Southwestern United States Polygons
38+
#'
39+
#' A `MULTIPOLYGON` containing the state boundaries for the southwestern United States (i.e., Arizona, Colorado, New Mexico, and Utah).
40+
#'
41+
#' @format An object of class `sfc_MULTIPOLYGON`.
42+
#' @source \url{https://github.com/adeckmyn/maps}
43+
"swus_states"
44+
45+
#' Southwestern United States and Mexico States Polygons
3846
#'
3947
#' A `MULTIPOLYGON` containing the state boundaries for the southwestern United States (i.e., Arizona, Colorado, New Mexico, and Utah) and Mexico.
4048
#'
4149
#' @format An object of class `sfc_MULTIPOLYGON`.
50+
#' @source \url{https://github.com/adeckmyn/maps}
4251
#' @source \url{https://www.arcgis.com/home/item.html?id=ac9041c51b5c49c683fbfec61dc03ba8}
43-
"usa_mexico_states"
52+
"swus_mexico_states"
4453

4554
#' Digital Elevation Model for the Southwestern United States and Mexico States
4655
#'

Diff for: data-raw/data.R

+15-14
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,7 @@ WorldClim_annual_gdd <- sum(WorldClim_monthly_gdd, na.rm = FALSE)
191191
usethis::use_data(WorldClim_annual_gdd,
192192
overwrite = TRUE)
193193

194-
# Create southwestern United States and Mexico states polygon.
195-
# Get Mexico states shapefile. Data was downloaded from https://www.arcgis.com/home/item.html?id=ac9041c51b5c49c683fbfec61dc03ba8.
196-
mexico_states <-
197-
sf::read_sf(here::here("data-raw/mexstates/mexstates.shp")) %>%
198-
dplyr::left_join(
199-
.,
200-
mxmaps::df_mxstate_2020 %>% dplyr::select(state_name, state_abbr) %>% dplyr::mutate(
201-
state_name = stringi::stri_trans_general(state_name, id = "Latin-ASCII")
202-
),
203-
by = c("ADMIN_NAME" = "state_name")
204-
) %>%
205-
dplyr::select(state_name = ADMIN_NAME, state_abbr, geom = geometry) %>%
206-
dplyr::mutate(country = "Mexico")
207-
194+
# Create southwestern United States shapefile.
208195
# Get USA states data from southwestern United States.
209196
swus_states <-
210197
sf::st_as_sf(maps::map("state", fill = TRUE, plot = FALSE)) %>%
@@ -227,6 +214,20 @@ swus_states <-
227214
usethis::use_data(swus_states,
228215
overwrite = TRUE)
229216

217+
# Create a shapefile to include Mexico with the swus_states.
218+
# Get Mexico states shapefile. Data was downloaded from https://www.arcgis.com/home/item.html?id=ac9041c51b5c49c683fbfec61dc03ba8.
219+
mexico_states <-
220+
sf::read_sf(here::here("data-raw/mexstates/mexstates.shp")) %>%
221+
dplyr::left_join(
222+
.,
223+
mxmaps::df_mxstate_2020 %>% dplyr::select(state_name, state_abbr) %>% dplyr::mutate(
224+
state_name = stringi::stri_trans_general(state_name, id = "Latin-ASCII")
225+
),
226+
by = c("ADMIN_NAME" = "state_name")
227+
) %>%
228+
dplyr::select(state_name = ADMIN_NAME, state_abbr, geom = geometry) %>%
229+
dplyr::mutate(country = "Mexico")
230+
230231
# Bind together to make a SWUS and Mexico file.
231232
swus_mexico_states <- dplyr::bind_rows(swus_states, mexico_states)
232233

Diff for: data/NASW_gdd.rda

-11.4 MB
Binary file not shown.

Diff for: data/swus_mexico_states.rda

63.4 KB
Binary file not shown.

Diff for: data/swus_states.rda

2.96 KB
Binary file not shown.

Diff for: man/usa_mexico_states.Rd renamed to man/swus_mexico_states.Rd

+6-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: man/swus_states.Rd

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)