Purpose

This analysis examines the geographic distribution of San Antonio Police Department (SAPD) records classified in the NIBRS Group category “Assault Offenses.” The analysis uses the incident identifier, report date, assault classification, and ZIP code in the supplied SafeDash export. The unit counted in the ZIP-code analysis is a distinct incident-identifier/ZIP-code combination, so multiple assault classifications for the same identifier and ZIP code are not counted more than once. Eight identifiers are associated with more than one ZIP code in the export; those ZIP associations are retained.

Load packages and data

Keep safedash_offenses(1).xlsx in the same folder as this RMarkdown file before knitting.

library(readxl)
library(dplyr)
library(ggplot2)
library(knitr)

safedash_offenses <-read_excel("safedash_offenses.xlsx")

# The first column in the supplied workbook has a blank header.
names(safedash_offenses)[1] <- "Incident_ID"

# Make the identifier and ZIP code consistent character fields.
safedash_offenses <- safedash_offenses %>%
  mutate(
    Incident_ID = as.character(Incident_ID),
    Zip_Code = trimws(as.character(Zip_Code))
  )

dim(safedash_offenses)
## [1] 538978      8
names(safedash_offenses)
## [1] "Incident_ID"         "Report_Date"         "NIBRS_Code_Name"    
## [4] "NIBRS_Crime_Against" "Service_Area"        "NIBRS_Group"        
## [7] "Zip_Code"            "DateTime"

Select Assault Offenses

assault_records <- safedash_offenses %>%
  filter(NIBRS_Group == "Assault Offenses")

nrow(assault_records)
## [1] 105827

Assault offense classifications

The classification table counts offense records. An incident may appear under more than one assault classification, so these category totals are not intended to represent mutually exclusive incident counts.

assault_category_counts <- assault_records %>%
  count(NIBRS_Code_Name, name = "Offense_Records") %>%
  mutate(Percent = round(100 * Offense_Records / sum(Offense_Records), 1)) %>%
  arrange(desc(Offense_Records))

kable(assault_category_counts)
NIBRS_Code_Name Offense_Records Percent
Simple Assault 72861 68.8
Aggravated Assault 18245 17.2
Intimidation 14721 13.9
ggplot(assault_category_counts,
       aes(x = reorder(NIBRS_Code_Name, Offense_Records),
           y = Offense_Records)) +
  geom_col() +
  coord_flip() +
  labs(
    title = "Assault Offense Records by NIBRS Classification",
    x = "Assault classification",
    y = "Number of offense records"
  ) +
  theme_minimal()

Prepare unique assault incidents and valid ZIP codes

The first column of the workbook functions as an incident identifier. Some identifiers appear more than once among assault offense records because one incident can have multiple assault classifications. The overall ZIP-code analysis therefore retains one record per incident-identifier/ZIP-code combination.

ZIP codes are considered valid for this analysis when they contain exactly five digits. Records labeled “Not Listed” or “Out of Jurisdiction” are excluded from ZIP-code comparisons but are counted and reported.

assault_incidents <- assault_records %>%
  distinct(Incident_ID, .keep_all = TRUE)

# Count each incident-ID / ZIP-code combination once. Eight identifiers in
# this export are associated with more than one ZIP code, so the unit below
# is an incident-ZIP combination rather than a claim of one exclusive ZIP
# assignment for every identifier.
assault_zip <- assault_records %>%
  distinct(Incident_ID, Zip_Code) %>%
  filter(grepl("^[0-9]{5}$", Zip_Code))

zip_exclusions <- assault_incidents %>%
  filter(!grepl("^[0-9]{5}$", Zip_Code)) %>%
  count(Zip_Code, name = "Incident_Count")

nrow(assault_records)
## [1] 105827
nrow(assault_incidents)
## [1] 105704
nrow(assault_zip)
## [1] 104530
n_distinct(assault_zip$Zip_Code)
## [1] 64
kable(zip_exclusions)
Zip_Code Incident_Count
Not Listed 32
Out of Jurisdiction 1150

Report-date coverage

assault_incidents <- assault_incidents %>%
  mutate(Report_Date = as.Date(Report_Date))

range(assault_incidents$Report_Date, na.rm = TRUE)
## [1] "2023-01-01" "2026-08-31"
assault_by_year <- assault_incidents %>%
  count(Year = format(Report_Date, "%Y"), name = "Unique_Incidents")

kable(assault_by_year)
Year Unique_Incidents
2023 29027
2024 29538
2025 27813
2026 19326

Distribution of assault incidents by ZIP code

assault_by_zip <- assault_zip %>%
  group_by(Zip_Code) %>%
  summarise(Incident_ZIP_Pairs = n(), .groups = "drop") %>%
  arrange(desc(Incident_ZIP_Pairs))

top_10_zip <- head(assault_by_zip, 10)

kable(top_10_zip)
Zip_Code Incident_ZIP_Pairs
78207 6427
78223 4491
78228 4418
78227 4098
78218 3584
78237 3516
78229 3451
78216 3331
78210 3288
78201 3173
ggplot(top_10_zip,
       aes(x = reorder(Zip_Code, Incident_ZIP_Pairs),
           y = Incident_ZIP_Pairs)) +
  geom_col() +
  coord_flip() +
  labs(
    title = "Top 10 ZIP Codes by Distinct Incident-ZIP Combinations",
    x = "ZIP code",
    y = "Number of distinct incident-ZIP combinations"
  ) +
  theme_minimal()

total_valid_incident_zip_pairs <- nrow(assault_zip)
top_10_pair_share <- sum(top_10_zip$Incident_ZIP_Pairs) / total_valid_incident_zip_pairs

total_valid_incident_zip_pairs
## [1] 104530
round(100 * top_10_pair_share, 2)
## [1] 38.05

Exploratory chi-square goodness-of-fit test

The following test compares the observed incident counts with a hypothetical distribution in which each of the 64 represented ZIP codes has the same expected number of incidents. This is an exploratory test of equal counts, not a test of population-adjusted crime rates. ZIP codes differ in population, land area, and the number of people present, and the supplied dataset does not contain population denominators. The result must therefore be interpreted cautiously.

zip_counts <- assault_by_zip$Incident_ZIP_Pairs

uniform_test <- chisq.test(
  x = zip_counts,
  p = rep(1 / length(zip_counts), length(zip_counts))
)

uniform_test
## 
##  Chi-squared test for given probabilities
## 
## data:  zip_counts
## X-squared = 78089, df = 63, p-value < 2.2e-16
uniform_test$expected
##  [1] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
##  [9] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
## [17] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
## [25] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
## [33] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
## [41] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
## [49] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
## [57] 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281 1633.281
# Check the expected-count condition for the chi-square approximation.
min(uniform_test$expected)
## [1] 1633.281
sum(uniform_test$expected < 5)
## [1] 0

Preliminary interpretation

The descriptive results identify where the largest numbers of reported assault incidents appear in the supplied SAPD records. The chi-square test evaluates whether those counts depart from a hypothetical equal-count distribution across represented ZIP codes. Because ZIP codes have different population sizes and levels of activity, the test does not establish that a ZIP code has a higher individual risk of victimization. Population-adjusted rates and additional neighborhood measures would be needed for that conclusion.

Limitations

The analysis is limited to reported SAPD records and the fields available in the supplied SafeDash export. It does not measure unreported assaults, population exposure, demographic characteristics, or conditions within smaller areas such as street segments. ZIP codes are broad geographic units and may conceal variation within each ZIP code. The 2026 data cover January through August only, so annual comparisons involving 2026 are incomplete. The findings describe the records in this dataset and should not be interpreted as causal effects or as population-adjusted crime rates.