knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", dpi = 150 )
The nycgeo
package contains spatial data files for various geographic and administrative boundaries in New York City as well as tools for working with NYC spatial data. Data is in the sf
(simple features) format and includes boundaries for boroughs (counties), public use microdata areas (PUMAs), community districts (CDs), neighborhood tabulation areas (NTAs), census tracts, census blocks, city council districts, school districts, and police precincts.
Additionally, selected demographic, social, and economic estimates from the U.S. Census Bureau American Community Survey can be added to the geographic boundaries in nycgeo
, allowing for contextualization and easy choropleth mapping. Finally, nycgeo
makes it simple to access a subset of spatial data in a particular geographic area, such as all census tracts in Brooklyn and Queens.
You can install nycgeo
from GitHub with:
# install.packages("remotes") remotes::install_github("mfherman/nycgeo")
To get the most out of nycgeo
, you should also install and load the sf package
when you use nycgeo
. If you haven't attached sf
, you will get this friendly reminder when you load nycgeo
:
library(nycgeo)
Depending on your operating system and available libraries, sf
can be tricky to install the first time. The sf
website is a good place to start if you're having trouble. If you're using macOS, this is a good guide to installing the required libraries.
# install.packages("sf") library(sf)
nycgeo
To learn how to use nycgeo
, check out the examples in the Introduction to nycgeo
vignette.
nycgeo
?The spatial files contained in the nycgeo
package are available on websites such as the New York City Department of City Planning's Bytes of the Big Apple and the U.S. Census Bureau TIGER/Line® Shapefiles, but this package aims to make accessing the spatial data more convenient. Instead of downloading and converting shapefiles each time you need them, nycgeo
provides the files in a consistent format (sf
) with added metadata that enable joins with non-spatial data.
Other R packages share some features with nycgeo
. In particular, the wonderful tidycensus
package can access the Census Bureau's API and download ACS estimates as well as TIGER/Line® Shapefiles (via tigris
).
One difference between the boundaries included here and the TIGER/Line® Shapefiles available through tigris
is that these boundaries are clipped to the shoreline, allowing for better mapping of New York City. Additionally, nycgeo
contains boundaries for geographic areas that are not available from the Census Bureau. This includes neighborhood tabulation areas (NTAs) and community districts (CDs).
Finally, all spatial data included in the package uses the NAD83 / New York Long Island (ftUS) State Plane projected coordinate system (EPSG 2263), which is the standard projection used by New York City government agencies.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.