Skip to content

Commit

Permalink
add crime risk data
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-brokamp committed Oct 14, 2023
1 parent bee34a1 commit 5db6525
Show file tree
Hide file tree
Showing 3 changed files with 318 additions and 0 deletions.
223 changes: 223 additions & 0 deletions inst/codec_data/hamilton_crime_risk/hamilton_crime_risk.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
census_tract_id_2010,Total,Personal,Murder,Rape,Robbery,Assault,Property,Burglary,Theft,MotVeh,year
39061024800,103,25,37,19,42,20,116,49,143,39,2020
39061024901,70,38,43,27,57,33,75,71,79,54,2020
39061025002,40,27,40,87,22,18,42,89,33,24,2020
39061025104,84,65,105,61,110,48,87,121,82,68,2020
39061025102,37,25,19,58,42,13,39,43,42,10,2020
39061024902,22,13,17,17,10,13,24,43,20,13,2020
39061025101,21,10,10,31,7,8,23,31,23,12,2020
39061025001,60,29,17,92,50,12,65,59,74,9,2020
39061008601,326,455,784,437,581,406,303,446,267,324,2020
39061008800,142,267,619,334,283,244,121,312,80,89,2020
39061009200,220,287,581,352,320,259,209,368,177,165,2020
39061009300,221,332,673,446,421,275,202,327,176,170,2020
39061009400,237,385,757,429,522,321,212,375,177,186,2020
39061009500,204,317,656,416,368,276,185,333,151,177,2020
39061009600,142,207,506,171,300,173,130,274,89,180,2020
39061027400,137,129,361,92,212,100,138,166,137,99,2020
39061027300,48,31,38,25,61,20,51,76,46,44,2020
39061025103,62,28,26,31,60,17,67,77,69,38,2020
39061006000,127,134,271,164,212,98,126,190,115,102,2020
39061022302,81,28,28,39,55,17,90,93,97,38,2020
39061023100,224,57,32,43,59,58,252,91,314,82,2020
39061023222,108,56,38,77,73,47,117,82,135,48,2020
39061009700,166,230,464,316,269,197,155,268,131,142,2020
39061009800,217,290,584,295,373,252,205,345,175,180,2020
39061009901,65,76,137,158,83,59,63,154,41,67,2020
39061009902,91,132,262,202,137,117,84,186,64,56,2020
39061010002,162,255,544,370,266,227,146,297,119,80,2020
39061010201,135,131,195,157,194,102,136,178,132,90,2020
39061010202,125,159,338,190,239,121,120,208,94,155,2020
39061023501,82,24,27,69,25,16,92,51,111,26,2020
39061023901,60,19,16,36,30,13,67,33,81,26,2020
39061024001,152,77,57,84,153,49,165,143,177,117,2020
39061010100,146,157,238,208,188,136,144,235,125,130,2020
39061020802,46,23,23,50,24,18,49,66,50,16,2020
39061020901,116,59,20,64,114,38,126,138,128,94,2020
39061010300,189,239,510,178,349,203,181,282,156,180,2020
39061010400,159,117,171,117,169,97,166,189,169,109,2020
39061010500,114,136,258,131,209,108,110,175,96,103,2020
39061010600,81,90,188,62,152,70,80,133,65,88,2020
39061010700,133,116,146,80,231,80,136,157,139,77,2020
39061010800,248,154,210,136,293,107,263,249,274,208,2020
39061010900,220,189,276,209,297,144,225,247,225,192,2020
39061011000,238,259,510,284,410,195,235,295,220,234,2020
39061011100,68,72,140,205,54,56,67,141,54,29,2020
39061021504,94,64,65,132,118,33,99,90,105,75,2020
39061021505,94,60,73,164,78,37,100,97,108,45,2020
39061022602,100,45,80,10,88,35,110,112,116,59,2020
39061022400,151,78,45,27,189,47,164,110,184,113,2020
39061022500,116,58,29,66,69,54,126,78,146,59,2020
39061023400,129,130,202,58,238,101,129,227,111,93,2020
39061021002,56,28,12,105,17,21,61,86,61,18,2020
39061021003,65,34,18,66,50,23,70,96,67,52,2020
39061020902,114,70,29,94,117,50,122,146,120,97,2020
39061021001,107,59,54,68,99,43,115,124,121,61,2020
39061000200,334,435,829,330,741,332,317,424,289,333,2020
39061000700,400,273,307,92,614,177,422,169,491,360,2020
39061000900,300,404,1066,233,615,341,282,284,306,101,2020
39061001000,352,416,767,447,623,330,342,335,369,155,2020
39061001100,389,502,849,516,759,401,369,367,386,253,2020
39061001600,267,431,1135,212,698,354,239,275,247,121,2020
39061001700,420,560,1168,640,760,462,397,444,403,272,2020
39061001800,293,316,580,251,520,247,289,325,286,245,2020
39061001900,301,225,269,232,426,150,315,274,335,234,2020
39061021422,84,70,117,84,99,55,86,136,77,73,2020
39061021202,57,35,44,43,60,24,61,76,63,25,2020
39061021401,76,37,45,69,41,30,82,111,81,44,2020
39061021571,99,56,63,87,82,41,106,103,116,37,2020
39061021801,137,90,154,104,174,56,145,122,156,102,2020
39061022102,69,51,78,34,106,33,72,91,69,56,2020
39061021101,20,10,15,30,10,7,22,30,21,10,2020
39061020812,59,24,48,40,31,18,65,60,72,16,2020
39061022000,36,16,15,41,9,14,39,31,46,6,2020
39061026102,45,21,22,13,26,20,49,54,51,23,2020
39061022700,244,199,348,89,357,156,252,336,235,236,2020
39061026002,64,27,20,37,19,29,70,82,73,26,2020
39061024322,34,17,15,46,17,12,37,35,42,8,2020
39061024303,33,21,8,84,9,15,35,38,36,19,2020
39061024100,38,20,25,32,31,15,41,31,45,29,2020
39061002000,287,187,316,129,345,137,304,300,318,218,2020
39061002200,290,339,829,158,616,258,281,384,256,286,2020
39061002300,505,520,950,586,734,423,502,480,524,377,2020
39061002500,264,235,377,106,517,151,269,338,231,422,2020
39061002600,263,244,397,30,572,157,267,361,219,446,2020
39061002700,231,250,553,122,469,184,228,319,207,224,2020
39061002800,323,285,473,282,457,220,330,309,345,257,2020
39061002900,199,166,247,72,361,109,205,207,206,189,2020
39061003000,170,127,178,28,364,56,177,163,165,284,2020
39061003200,455,325,430,226,650,221,478,414,485,531,2020
39061022200,89,56,108,49,139,27,95,72,106,59,2020
39061023201,172,91,93,70,141,76,186,134,212,88,2020
39061023800,129,100,139,63,199,69,134,186,125,108,2020
39061024200,80,74,150,56,131,54,81,114,76,66,2020
39061024700,506,52,123,42,129,25,583,84,778,41,2020
39061025300,179,95,48,151,187,54,193,176,211,96,2020
39061025401,223,93,6,61,242,46,245,169,280,115,2020
39061020401,66,47,37,90,30,47,69,87,69,38,2020
39061024321,28,16,6,48,22,9,30,40,30,11,2020
39061023902,46,16,16,24,24,12,51,23,63,15,2020
39061024002,93,54,59,27,132,31,99,68,112,57,2020
39061003300,288,209,358,90,451,138,302,316,294,331,2020
39061003600,223,348,769,258,503,297,201,332,179,135,2020
39061003700,242,264,488,176,469,200,237,285,232,199,2020
39061003800,245,359,809,215,579,293,225,366,193,217,2020
39061003900,255,385,908,237,618,314,233,427,187,235,2020
39061004000,235,215,388,199,361,161,238,283,228,232,2020
39061004100,250,233,492,126,438,171,253,315,242,228,2020
39061004200,215,147,272,73,301,100,226,219,235,176,2020
39061004701,180,79,67,120,131,53,197,223,205,92,2020
39061004800,160,83,52,247,83,58,173,194,183,67,2020
39061025402,215,75,13,171,134,40,238,174,272,110,2020
39061025500,181,107,63,100,218,68,194,205,203,108,2020
39061025600,187,100,53,68,233,58,202,204,206,168,2020
39061020501,76,32,9,101,8,30,84,87,90,29,2020
39061020502,38,21,22,20,29,18,41,39,42,31,2020
39061020504,76,38,22,126,26,28,83,78,91,32,2020
39061020601,42,20,20,57,8,19,45,60,46,14,2020
39061020602,41,13,8,12,15,13,46,60,45,32,2020
39061020701,100,55,39,101,68,43,107,100,118,44,2020
39061024301,91,38,31,22,77,26,100,101,106,55,2020
39061021701,189,142,106,194,170,125,197,232,197,131,2020
39061021802,111,78,145,90,125,58,117,148,117,68,2020
39061025200,182,93,59,177,150,60,197,196,212,94,2020
39061023521,109,52,65,251,42,24,119,64,142,42,2020
39061025800,130,95,164,76,175,67,136,152,139,88,2020
39061004900,122,58,53,110,99,35,133,179,133,53,2020
39061005000,186,115,116,100,251,68,198,231,195,165,2020
39061005100,119,47,19,134,77,23,131,165,131,71,2020
39061005200,205,110,60,60,273,59,221,260,221,160,2020
39061005400,343,224,273,138,471,147,363,295,392,271,2020
39061005500,277,252,449,211,436,188,281,294,285,234,2020
39061005600,136,114,249,146,189,80,139,184,135,93,2020
39061005701,133,129,236,109,268,79,133,199,122,105,2020
39061021604,122,90,128,155,91,78,128,189,119,90,2020
39061026101,81,17,31,16,33,12,92,45,111,39,2020
39061020705,103,43,44,101,32,39,113,129,121,33,2020
39061020505,94,49,36,144,29,41,102,139,103,31,2020
39061021509,111,67,104,145,67,55,119,142,123,52,2020
39061020742,87,62,47,170,24,58,92,187,75,50,2020
39061020762,177,115,142,161,165,89,188,202,196,107,2020
39061022301,211,132,95,160,273,77,224,97,262,172,2020
39061023001,235,110,85,112,198,79,256,149,297,147,2020
39061023002,124,51,30,108,31,49,137,100,159,40,2020
39061021602,133,124,155,87,193,104,135,183,118,175,2020
39061021900,162,146,244,153,233,111,164,209,158,133,2020
39061022101,48,18,24,23,26,15,53,52,57,29,2020
39061026200,102,82,84,18,129,74,105,158,99,62,2020
39061005702,190,201,352,151,376,142,188,244,177,167,2020
39061005800,128,149,274,145,240,114,125,216,109,84,2020
39061005900,182,165,290,86,320,119,185,213,183,158,2020
39061006100,172,147,395,77,279,105,176,209,170,164,2020
39061006300,203,187,399,234,293,137,205,274,186,228,2020
39061006400,258,280,554,242,511,196,254,283,244,273,2020
39061006500,125,178,356,66,362,126,116,177,101,117,2020
39061021603,77,50,56,112,39,44,82,130,73,59,2020
39061021702,165,148,162,134,229,121,167,236,157,125,2020
39061021508,70,30,20,99,19,23,77,75,86,16,2020
39061020811,87,77,123,92,102,65,89,144,81,53,2020
39061020761,106,67,60,98,79,58,113,130,116,61,2020
39061020707,36,16,26,25,21,12,39,45,42,10,2020
39061022601,33,14,18,16,23,11,37,25,43,14,2020
39061020741,87,45,28,107,33,40,94,137,91,49,2020
39061021572,109,71,94,123,129,42,116,105,125,63,2020
39061023522,77,33,67,89,35,22,84,58,98,28,2020
39061023210,67,26,17,58,21,23,74,53,87,16,2020
39061006600,187,321,736,156,546,257,165,271,135,196,2020
39061006800,198,292,710,155,477,238,182,296,157,163,2020
39061006900,229,323,742,215,552,249,213,343,181,218,2020
39061007000,207,190,306,64,451,113,210,285,182,285,2020
39061007100,126,118,190,54,295,62,127,190,103,189,2020
39061007200,223,179,245,134,364,118,231,260,224,232,2020
39061007300,264,265,533,192,453,203,264,317,247,286,2020
39061007400,240,274,579,206,426,223,234,299,225,190,2020
39061026001,63,11,16,17,14,9,72,40,86,32,2020
39061023701,55,29,46,47,37,22,59,40,64,51,2020
39061023702,77,41,43,55,60,32,83,69,91,51,2020
39061021102,27,12,14,47,6,8,29,26,31,23,2020
39061021201,32,14,26,24,17,11,35,36,38,15,2020
39061021302,41,19,26,28,33,13,45,35,52,16,2020
39061021303,38,9,4,36,7,6,43,32,50,6,2020
39061021304,79,27,26,54,35,20,88,62,102,34,2020
39061023300,58,35,47,35,58,27,61,50,68,34,2020
39061023600,45,24,24,71,19,19,49,74,45,39,2020
39061004500,54,33,80,49,49,24,58,101,51,31,2020
39061004602,90,73,110,152,80,58,93,151,90,22,2020
39061004603,68,59,93,152,59,44,70,134,61,18,2020
39061004702,299,200,262,167,345,151,316,274,335,253,2020
39061024400,70,47,49,42,63,42,74,84,75,52,2020
39061007500,200,187,373,166,302,145,203,237,196,192,2020
39061007700,244,388,822,271,609,318,220,414,162,301,2020
39061007800,237,267,544,308,388,212,232,306,221,189,2020
39061007900,167,227,503,246,295,194,157,263,138,107,2020
39061008000,285,414,729,393,617,338,263,374,225,342,2020
39061008100,224,248,525,237,397,190,220,291,206,200,2020
39061021421,57,25,20,68,33,16,63,77,63,36,2020
39061025700,140,123,540,206,204,71,143,177,138,124,2020
39061021506,76,46,48,181,30,31,81,88,89,14,2020
39061021501,122,102,107,269,135,63,126,76,146,68,2020
39061010005,161,176,347,146,262,146,159,225,149,117,2020
39061010004,150,220,448,377,286,166,138,205,124,125,2020
39061010003,141,203,474,307,245,165,130,231,107,128,2020
39061004605,117,99,210,108,148,77,121,196,111,61,2020
39061008201,148,180,359,185,297,133,143,229,123,140,2020
39061008202,228,261,477,270,434,193,223,263,217,195,2020
39061008300,191,174,270,310,192,143,194,223,198,114,2020
39061008400,182,262,502,369,355,207,168,252,152,136,2020
39061008501,168,329,748,425,372,289,140,338,90,166,2020
39061008502,242,462,942,455,637,391,205,451,138,266,2020
39061005302,198,92,102,39,227,52,216,172,242,105,2020
39061005301,241,140,127,37,359,77,258,253,267,201,2020
39061004604,75,93,220,112,121,77,72,145,61,23,2020
39061020403,32,25,19,45,31,20,33,49,30,28,2020
39061020404,27,18,13,66,9,13,28,33,29,15,2020
39061026300,418,438,814,320,739,340,415,381,413,487,2020
39061026500,440,254,337,60,620,151,472,214,533,473,2020
39061026400,357,452,894,399,726,352,341,413,317,393,2020
39061026900,332,470,955,409,742,371,308,334,318,196,2020
39061026700,404,474,948,431,747,372,392,404,401,311,2020
39061027000,303,411,793,309,655,331,284,359,270,258,2020
39061026800,310,208,163,135,398,151,327,325,336,274,2020
39061027100,214,220,424,178,444,142,213,239,201,256,2020
39061027200,221,310,629,333,377,275,206,355,179,144,2020
39061026600,288,193,286,225,314,142,304,274,319,251,2020
58 changes: 58 additions & 0 deletions inst/codec_data/hamilton_crime_risk/tabular-data-resource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
profile: tabular-data-resource
name: hamilton_crime_risk
path: hamilton_crime_risk.csv
version: v0.1.0
title: Hamilton County Crime Risk
homepage: https://geomarker.io/hamilton_crime_risk
description: Average [crime risk](https://github.com/geomarker-io/hamilton_crime_risk/blob/master/AGS-CrimeRisk-Methodology-2022A.pdf)
(2014-2020) at 2020 census blocks interpolated (population weighted) to 2010 census
tracts.
schema:
fields:
census_tract_id_2010:
name: census_tract_id_2010
type: string
Total:
name: Total
type: number
title: Total Crime Risk
Personal:
name: Personal
type: number
title: Personal Crime Risk
Murder:
name: Murder
type: number
title: Murder Crime Risk
Rape:
name: Rape
type: number
title: Rape Crime Risk
Robbery:
name: Robbery
type: number
title: Robbery Crime Risk
Assault:
name: Assault
type: number
title: Assault Crime Risk
Property:
name: Property
type: number
title: Property Crime Risk
Burglary:
name: Burglary
type: number
title: Burglary Crime Risk
Theft:
name: Theft
type: number
title: Theft Crime Risk
MotVeh:
name: MotVeh
type: number
title: Motor Vehicle Crime Risk
year:
name: year
type: number
description: Represents 2014 - 2020 average
37 changes: 37 additions & 0 deletions inst/hamilton_crime_risk.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
devtools::load_all()
name <- "hamilton_crime_risk"
version <- "v0.1.0"

rd <-
fr::read_fr_tdr(glue::glue(
"https://github.com/geomarker-io/",
"{name}/releases/download/{version}/"
))

md <- as.list(rd)

d <-
tibble::as_tibble(rd) |>
dplyr::rename(census_tract_id_2010 = census_tract_id) |>
dplyr::mutate(year = as.integer(2020))

# create tdr by adding back in metadata for any
# columns present in the original metadata
d_tdr <-
purrr::reduce2(
names(d),
md$schema$fields[names(d)],
\(accum, xx, yy) fr::update_field(x = accum, field = xx, !!!yy),
.init = fr::as_fr_tdr(
d,
name = name,
version = version,
title = "Hamilton County Crime Risk",
description = "Average [crime risk](https://github.com/geomarker-io/hamilton_crime_risk/blob/master/AGS-CrimeRisk-Methodology-2022A.pdf) (2014-2020) at 2020 census blocks interpolated (population weighted) to 2010 census tracts.",
homepage = "https://geomarker.io/hamilton_crime_risk"
)
) |>
fr::update_field("year", description = "Represents 2014 - 2020 average")

fr::write_fr_tdr(d_tdr, fs::path_package("codec", "codec_data"))
check_codec_tdr_csv(fs::path_package("codec", "codec_data", name))

0 comments on commit 5db6525

Please sign in to comment.