MyNixOS website logo
Description

Convenient Access to NYC Open Data API Endpoints.

Provides a unified set of helper functions to access datasets from the NYC Open Data platform <https://opendata.cityofnewyork.us/>. Functions return results as tidy tibbles and support optional filtering, sorting, and row limits via the Socrata API. The package includes endpoints for 311 service requests, DOB job applications, juvenile justice metrics, school safety, environmental data, event permitting, and additional citywide datasets.

nycOpenData nycOpenData logo

CRAN status CRAN downloads Lifecycle: stable Project Status: Active Codecov test coverage R-bloggers R Weekly R-CMD-check

nycOpenData provides simple, reproducible access to datasets from the
NYC Open Data platform — directly from R,
with no API keys or manual downloads required. The package is available on CRAN.

Version 0.1.6 now includes wrappers for 40+ NYC Open Data APIs, covering:

  • 311 Service Requests
  • For-Hire Vehicles (FHV)
  • Juvenile Justice (rearrest rates + caseloads)
  • School Discharge Reporting
  • Violent & Disruptive School Incidents
  • Detention Admissions
  • Borough/Community District Reports
  • Street Tree Census
  • Urban Park Ranger Animal Condition Responses
  • Permitted Events (Historical)
  • and more

All functions return clean tibble outputs and support filtering via
filters = list(field = "value").


Installation

From CRAN

install.packages("nycOpenData")

Development version (GitHub)

devtools::install_github("martinezc1/nycOpenData")

Example

library(nycOpenData)

# Get 5,000 most recent 311 requests
data <- nyc_311(limit = 5000)

# Filter by agency and city
filtered <- nyc_311(
  limit = 2000,
  filters = list(agency = "NYPD", city = "BROOKLYN")
)

head(filtered)
## # A tibble: 6 × 37
##   unique_key created_date           agency agency_name complaint_type descriptor
##   <chr>      <chr>                  <chr>  <chr>       <chr>          <chr>     
## 1 67613985   2026-01-26T02:06:05.0… NYPD   New York C… Noise - Resid… Banging/P…
## 2 67609553   2026-01-26T02:02:09.0… NYPD   New York C… Noise - Resid… Banging/P…
## 3 67610990   2026-01-26T01:58:58.0… NYPD   New York C… Illegal Parki… Blocked H…
## 4 67615428   2026-01-26T01:56:49.0… NYPD   New York C… Noise - Resid… Banging/P…
## 5 67609568   2026-01-26T01:48:16.0… NYPD   New York C… Noise - Resid… Loud Musi…
## 6 67612476   2026-01-26T01:47:10.0… NYPD   New York C… Noise - Resid… Loud Musi…
## # ℹ 31 more variables: location_type <chr>, incident_zip <chr>,
## #   incident_address <chr>, street_name <chr>, cross_street_1 <chr>,
## #   cross_street_2 <chr>, intersection_street_1 <chr>,
## #   intersection_street_2 <chr>, address_type <chr>, city <chr>,
## #   landmark <chr>, status <chr>, community_board <chr>,
## #   council_district <chr>, police_precinct <chr>, bbl <chr>, borough <chr>,
## #   x_coordinate_state_plane <chr>, y_coordinate_state_plane <chr>, …

Learn by example

  • vignette("nyc-311", package = "nycOpenData") – Working with NYC 311 data end-to-end

About

nycOpenData makes New York City’s civic datasets accessible to students,
educators, analysts, and researchers through a unified and user-friendly R interface.
Developed to support reproducible research, open-data literacy, and real-world analysis.


Comparison to Other Software

While the RSocrata package provides a general interface for any Socrata-backed portal, nycOpenData is specifically tailored for the New York City ecosystem.

  • Ease of Use: No need to hunt for 4x4 dataset IDs (e.g., erm2-nwe9); functions like nyc_311() map directly to the most popular city datasets.
  • Pre-configured Logic: Wrappers include default sorting (e.g., created_date DESC) and optimized limit handling specific to NYC’s massive data volumes.
  • Open Literacy: Designed specifically for students and researchers to lower the barrier to entry for civic data analysis.

Contributing

We welcome contributions! If you find a bug or would like to request a wrapper for a specific NYC dataset, please open an issue or submit a pull request on GitHub.


Authors & Contributors

Maintainer

Christian A. Martinez 📧 [email protected]
GitHub: @martinezc1

✨ Contributors

Special thanks to the students of PSYC 7750G – Reproducible Psychological Research at Brooklyn College (CUNY) who have contributed functions and documentation:

  • Crystal Adote (@crystalna20) — Added support for the NYPD Hate Crimes dataset.
  • Jonah Dratfield (@jdratfield38) — Added support for the Local Law 18 Pay and Demographics Report.
  • Joyce Escatel-Flores (@JoyceEscatel) — Added support for NYPD Shooting Incident Data (Year To Date).
  • Rob Hutto (@robhutto) — Added support for the New York City Population by Borough, 1950–2040 dataset.
  • Isley Jean-Pierre (@ijpier) — Added support for Inmate Incidents – Slashing and Stabbing.
  • Shannon Joyce (@shannonjoyce) — Added support for the NYC Wetlands dataset, including tests and vignette.
  • Laura Rose-Werner (@laurarosewerner) — Added support for the NYCHA Violations dataset.
  • Emma Tupone (@emmatup0205) — Added support for NYC Climate Projections: Extreme Events and Sea Level Rise.
  • Xinru Wang (@xrwangxr) — Added support for the Local Law 97 of 2021 – Pets in Shelter Report.

Academic Context

This package is developed as a primary pedagogical tool for teaching data acquisition and open science practices at Brooklyn College, City University of New York (CUNY).

Metadata

Version

0.1.6

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows