Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

01_violations_lead.rmd review #3

Open
romartinez-nycc opened this issue Apr 24, 2023 · 0 comments
Open

01_violations_lead.rmd review #3

romartinez-nycc opened this issue Apr 24, 2023 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@romartinez-nycc
Copy link
Contributor

  • File folder location changed, update to source("../code/utils/make_cd.R")

    source("code/utils/make_cd.R")

  • For Make_cd.R, it uses the new council district boundaries instead of the old ones. Here is some code to use the previous CDs

council_districts = unzip_sf("https://www.nyc.gov/assets/planning/download/zip/data-maps/open-data/nycc_21d.zip") %>% st_read() %>% st_transform(st_crs(4326))

  • Data not in found, please add it! 😅 I'm unable to run the code for reproducibility.

    hmcv_sub <- fread("data/lead_data_hmcv_4_11_23.csv")

  • It would be helpful to add comments for non-datatable folk.

    hmcv_sub[, inspectiondate := as.Date(inspectiondate)]
    hmcv_sub[, yearinspect := year(inspectiondate)]
    # check nas
    hmcv_sub[streetname %in% "FOREST AVENUE" & housenumber %in% "861", councildistrict := 49]
    hmcv_sub[streetname %in% "BEACH 88 STREET", councildistrict := 32]
    hmcv_sub[streetname %in% "GRAND CENTRAL PARKWAY SOUTH", councildistrict := 24]
    hmcv_sub[streetname %in% "ADAM CLAYTONPOWELL JR BOULEVARD", councildistrict := 9]
    lead_paint <- hmcv_sub[grep("SECTION 27-2056.6", novdescription, ignore.case = TRUE), .(violationid, inspectiondate, CounDist=councildistrict, yearinspect)]
    # number of violations per year by cd
    lead_paint_cd <- lead_paint[, .(vios_cd = length(unique(violationid))), by = .(CounDist, yearinspect)]
    # number of violations per day citywide
    lead_paint_vios_day <- lead_paint[, .(vios_day = .N), by = .(inspectiondate)]

@romartinez-nycc romartinez-nycc added the documentation Improvements or additions to documentation label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants