get_area_crime: Get area crimes from Open Baltimore

View source: R/get_area_crime.R

get_area_crimeR Documentation

Get area crimes from Open Baltimore

Description

Get reported crimes since 2014 for a specific area.

Usage

get_area_crime(
  area,
  description = NULL,
  date_range = NULL,
  where = NULL,
  dist = NULL,
  diag_ratio = NULL,
  asp = NULL,
  unit = "m",
  trim = FALSE,
  crs = pkgconfig::get_config("mapbaltimore.crs", 2804)
)

Arguments

area

sf, sfc, or bbox object. If multiple areas are provided, they are unioned into a single sf object using sf::st_union().

description

Crime type or description. Supported options include "AGG. ASSAULT", "ARSON", "AUTO THEFT", "BURGLARY", "COMMON ASSAULT", "HOMICIDE", "LARCENY", "LARCENY FROM AUTO", "RAPE", "ROBBERY - CARJACKING", "ROBBERY - COMMERCIAL", "ROBBERY - RESIDENCE", "ROBBERY - STREET", or "SHOOTING". Not case sensitive.

date_range

Date range as character vector in format of c("YYYY-MM-DD", "YYYY-MM-DD"). Minimum and maximum values are used if length is greater than 1.

where

where query string passed to esri2sf, Default: NULL

dist

buffer distance in units. Optional.

diag_ratio

ratio of diagonal distance of area's bounding box used as buffer distance. e.g. if the diagonal distance is 3000 meters and the "diag_ratio = 0.1" a 300 meter will be used. Ignored when dist is provided.

asp

Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric, get_asp() returns the same value without modification.

unit

Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"

trim

If TRUE, x is trimmed to y with st_trim().

crs

Cordinate reference system to return, Default: 4326 for sf_to_df() and NULL for df_to_sf().

Examples

## Not run: 
# Get shootings for the Lauraville area
area <- get_area("neighborhood", "Barclay")
crimes <- get_area_crime(
  area = area,
  date_range = c("2022-01-01", "2022-12-31"),
  description = "SHOOTING"
)

## End(Not run)

elipousson/mapbaltimore documentation built on Dec. 1, 2024, 1:22 p.m.