├── .gitignore ├── README.md ├── speedviolations.Rproj └── highviolaters.R /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .httr-oauth 5 | .DS_Store 6 | .quarto 7 | highviolaters2025full.csv 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # speedviolations 2 | 3 | Data files were created with `highviolaters.R` 4 | 5 | 2024 -- complete 6 | 7 | 2025 -- rows with num_ticket equal to 1 were filtered out 8 | -------------------------------------------------------------------------------- /speedviolations.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /highviolaters.R: -------------------------------------------------------------------------------- 1 | library(tidyverse) 2 | library(data.table) 3 | 4 | # Downloaded dataset from: https://dev.socrata.com/foundry/data.cityofnewyork.us/nc67-uf89 5 | df2 = fread("~/Downloads/Open_Parking_and_Camera_Violations_20251213.csv") 6 | 7 | df2024 <- df2 |> filter(str_detect(`Issue Date`, "2024")) 8 | 9 | df2024$Date <- as.Date(df2024$`Issue Date`, format = "%m/%d/%Y") 10 | 11 | df2024$`Amount Due` <- readr::parse_number(df2024$`Amount Due`) 12 | 13 | df2024$In_judgment <- ifelse(df2024$`Judgment Entry Date` != "", TRUE, FALSE) 14 | 15 | highviolaters <- df2024 |> 16 | group_by(State, Plate, In_judgment) |> 17 | summarize(total_amt = sum(`Amount Due`), 18 | num_tickets = n()) 19 | 20 | highviolaters <- highviolaters |> 21 | filter(total_amt != 0) 22 | 23 | write_csv(highviolaters, "data/highviolaters2024.csv") 24 | 25 | df2025 <- df2 |> filter(str_detect(`Issue Date`, "2025")) 26 | 27 | df2025$Date <- as.Date(df2025$`Issue Date`, format = "%m/%d/%Y") 28 | 29 | df2025$`Amount Due` <- readr::parse_number(df2025$`Amount Due`) 30 | 31 | df2025$In_judgment <- ifelse(df2025$`Judgment Entry Date` != "", TRUE, FALSE) 32 | 33 | highviolaters <- df2025 |> 34 | group_by(State, Plate, In_judgment) |> 35 | summarize(total_amt = sum(`Amount Due`), 36 | num_tickets = n()) 37 | 38 | highviolaters <- highviolaters |> 39 | filter(total_amt != 0) 40 | 41 | write_csv(highviolaters, "data/highviolaters2025full.csv") 42 | 43 | highviolaters <- highviolaters |> 44 | filter(num_tickets > 1) 45 | 46 | write_csv(highviolaters, "data/highviolaters2025.csv") 47 | --------------------------------------------------------------------------------