NewYorkCityCouncil / pool_access

Data Analysis & Visuals for April 2023 Pool Legislation Hearing
https://council.nyc.gov/data/pools/
0 stars 0 forks source link

CR request #1

Open amd112 opened 1 year ago

amd112 commented 1 year ago

Particular issues I'd like extra eyes on:

romartinez-nycc commented 1 year ago

01

Should we also set the CRS here?

Your code here works just as well for joining overlapping areas with st_interesect(),

https://github.com/NewYorkCityCouncil/pool_access/blob/ba2bc980c65bcdcde64c0f8cf37bd31657a12507/code/01_get_isochrones.R#L80

FIXED! #Getting error msg when pulling census pop data

Error in UseMethod("gather") : no applicable method for 'gather' applied to an object of class "character"

02

amd112 commented 1 year ago

1) They are both natively ESPG 4326!

2) updated to overlaps_area <- no_use %>% st_join(interest_area, left = F) which passes the identical() check.

3) I haven't actually used any of the drive code yet so I think we should come back to this once that section is either implemented or removed [e: it was referencing pools_drive_zone_15min instead of land_drive_zone_15min - fixed]

4) what did you fix? what code did you change?

romartinez-nycc commented 1 year ago

FIXED! It wasn't reading my census API key, leading to a gather error, I didn't edit any of your code, only on my end I fixed the API key setup

Getting error msg when pulling census pop data

Error in UseMethod("gather") : no applicable method for 'gather' applied to an object of class "character"

We do now have estimated population distributions using bbls - which we found to be not far off from tracts & blocks

https://github.com/NewYorkCityCouncil/pool_access/blob/ba2bc980c65bcdcde64c0f8cf37bd31657a12507/code/01_get_isochrones.R#L119

Your logic/method makes sense for getting % or people within the pool zone

I get the same 68% number when summing up the blocks to get the 'near a pool percent'. The only issue on the website 68% is written as being not near a pool...


mutate(total_area = as.numeric(st_area(.)), 
area_within_pool_zone = replace_na(area_within_pool_zone, 0), 
perc_area = (total_area - area_within_pool_zone)/total_area,
     # get rid of tiny measurement errors like -0.000000001
     perc_area = ifelse(perc_area < 0, 0, perc_area), 

     # scale pop by (assumed) % not in zone
     pop = value * perc_area, 
     tot_pop = value) %>%

select(-total_area, -area_within_pool_zone, -value)

romartinez-nycc commented 1 year ago
  1. They are both natively ESPG 4326!
  2. updated to overlaps_area <- no_use %>% st_join(interest_area, left = F) which passes the identical() check.
  3. I haven't actually used any of the drive code yet so I think we should come back to this once that section is either implemented or removed [e: it was referencing pools_drive_zone_15min instead of land_drive_zone_15min - fixed]
  4. what did you fix? what code did you change?

Similar to #2 above, here it can be updated to use st_join() as well

https://github.com/NewYorkCityCouncil/pool_access/blob/ba2bc980c65bcdcde64c0f8cf37bd31657a12507/code/01_get_isochrones.R#L144 https://github.com/NewYorkCityCouncil/pool_access/blob/ba2bc980c65bcdcde64c0f8cf37bd31657a12507/code/01_get_isochrones.R#L147