Skip to content

Commit

Permalink
retiring sp; sentencing -> sf
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorDonegan committed Sep 30, 2023
1 parent f3c4f29 commit 613d5ab
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
Biarch: true
Depends:
R (>= 3.4.0)
R (>= 4.0)
Imports:
spdep (>= 1.1-8),
sf,
sf (>= 1.0-10),
ggplot2 (>= 3.0.0),
methods,
graphics,
Expand Down
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
#' Mullen, Lincoln A. and Bratt, Jordon. "USABoundaries: Historical and Contemporary Boundaries of the United States of America,"
#' Journal of Open Source Software 3, no. 23 (2018): 314, \doi{10.21105/joss.00314}.
#'
#' @description A spatial polygons data frame of historical 1910 county boundaries of Florida with aggregated state prison sentencing counts and census data.
#' @description Simple features (`sf`) with historic (1910) county boundaries of Florida with aggregated state prison sentencing counts and census data.
#' Sentencing and population counts are aggregates over the period 1905-1910, where populations were interpolated linearly between decennial censuses of 1900 and 1910.
#' @format A spatial polygons data frame with the following attributes:
#' @format Simple features (`sf`)/`data.frame` with the following attributes:
#' \describe{
#' \item{name}{County name}
#' \item{wpop}{White population total for years 1905-1910}
Expand Down
21 changes: 10 additions & 11 deletions R/stan_esf.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,17 @@
#' log.SSR <- log( SSR, base = 2 )
#'
#' # map the log-SSRs
#' st_as_sf(sentencing) %>%
#' ggplot() +
#' geom_sf(aes(fill = log.SSR)) +
#' scale_fill_gradient2(
#' midpoint = 0,
#' name = NULL,
#' breaks = seq(-3, 3, by = 0.5)
#' ggplot(sentencing) +
#' geom_sf(aes(fill = log.SSR)) +
#' scale_fill_gradient2(
#' midpoint = 0,
#' name = NULL,
#' breaks = seq(-3, 3, by = 0.5)
#' ) +
#' labs(title = "Log-Standardized Sentencing Ratios",
#' subtitle = "log( Fitted/Expected ), base 2"
#' ) +
#' labs(title = "Log-Standardized Sentencing Ratios",
#' subtitle = "log( Fitted/Expected ), base 2"
#' ) +
#' theme_void()
#' theme_void()
#' }
#' @export
#' @md
Expand Down
2 changes: 1 addition & 1 deletion R/stan_icar.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
#' SSR <- f / sentencing$expected_sents
#' log.SSR <- log( SSR, base = 2)
#'
#' ggplot( st_as_sf(sentencing) ) +
#' ggplot(sentencing) +
#' geom_sf(aes(fill = log.SSR)) +
#' scale_fill_gradient2(
#' low = "navy",
Expand Down
4 changes: 3 additions & 1 deletion data-raw/sentencing-data.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# download sf file with Florida counties and state prison sentencing data, 1905-1910
library(readr)
library(sf)
tf <- tempfile(fileext = ".rds")
download.file("https://github.com/ConnorDonegan/convict-leasing/raw/master/data/constructed/florida-1910-sp.rds", tf)
fl <- read_rds(tf)
fl@data <- fl@data[, c("name", "wpop", "bpop", "sents", "plantation_belt", "pct_ag_1910", "expected_sents")]
fl@data$sir_raw <- with(fl@data, sents / expected_sents)
sentencing <- fl
sentencing <- st_as_sf(fl)
usethis::use_data(sentencing, overwrite = TRUE)

Binary file modified data/sentencing.rda
Binary file not shown.

0 comments on commit 613d5ab

Please sign in to comment.