Skip to content

Commit

Permalink
rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
pspauster committed Nov 27, 2023
1 parent 8b2a2ef commit 8247977
Show file tree
Hide file tree
Showing 13 changed files with 478 additions and 1,160 deletions.
24 changes: 12 additions & 12 deletions 17.sf.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,18 @@ points_polygons_join %>%

What if I wanted to find the proportion of affordable housing in the flood zone? I can do this with an intersects and mutate - I don't even need to join the two datasets!

```{r}
floodplain_2020s_100y <- read_sf("https://data.cityofnewyork.us/resource/inra-wqx3.geojson?$limit=10000") %>%
st_make_valid() %>% #this magic function repairs any invalid geometries
st_union() %>% #here I make the entire floodplain into one big shape
st_set_crs(st_crs(points_polygons_join)) #and set it to the same crs as my points
points_polygons_join %>%
mutate(fplain_2020s_100y = lengths(st_intersects(.,floodplain_2020s_100y))) %>% #st_intersects returns a list of the shapes it intersects with - if its 0 it didn't intersect, if its 1 it did!
as.data.frame() %>%
group_by(fplain_2020s_100y) %>%
summarize(count = n(),
units = sum(all_counted_units, na.rm = T))
```{r flood zones}
# floodplain_2020s_100y <- read_sf("https://data.cityofnewyork.us/resource/inra-wqx3.geojson?$limit=10000") %>%
# st_make_valid() %>% #this magic function repairs any invalid geometries
# st_union() %>% #here I make the entire floodplain into one big shape
# st_set_crs(st_crs(points_polygons_join)) #and set it to the same crs as my points
#
# points_polygons_join %>%
# mutate(fplain_2020s_100y = lengths(st_intersects(.,floodplain_2020s_100y))) %>% #st_intersects returns a list of the shapes it intersects with - if its 0 it didn't intersect, if its 1 it did!
# as.data.frame() %>%
# group_by(fplain_2020s_100y) %>%
# summarize(count = n(),
# units = sum(all_counted_units, na.rm = T))
```

Expand Down
183 changes: 116 additions & 67 deletions docs/17.sf.html

Large diffs are not rendered by default.

Binary file modified docs/17.sf_files/figure-html/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/17.sf_files/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/17.sf_files/figure-html/unnamed-chunk-18-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/17.sf_files/figure-html/unnamed-chunk-28-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/17.sf_files/figure-html/unnamed-chunk-32-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/17.sf_files/figure-html/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8247977

Please sign in to comment.