Description Usage Arguments Details Value Examples
Point-in-polygon operation for NYC administrative boundaries. Use
nyc_point_poly()
on a set of points to determine which administrative
district each point lies within.
1 2 | nyc_point_poly(points, geography = c("borough", "puma", "nta", "cd",
"tract", "block", "school", "police", "council", "cong"))
|
points |
An |
geography |
A character vector of administrative boundaries to append to points. Possible values are "borough", "puma", "cd", "nta", "school", "council", "police", "cong", "tract" and "block". If more than one geography is selected, names and codes for each geography is appended. |
Using nyc_point_poly()
requires installing the sf package.
An sf
object of point features with administrative district names
and and codes appended.
1 2 3 4 5 6 7 | if (require(sf)) {
# generate 100 random points in nyc
points <- st_sf(geometry = st_sample(nyc_boundaries(), 100))
nyc_point_poly(points = points, geography = c("borough", "nta", "cd"))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.