7  Environmental Stressors and Social Complaints in New York City

Author

Emma Valentina

8 Environmental Stressors and Social Complaints in New York City

Climate change increasingly affects urban environments through flooding, extreme weather, and infrastructure strain. Beyond physical impacts, environmental stressors may influence psychological well-being and social behavior, particularly in dense urban settings such as New York City. Environmental stress theory suggests that chronic exposure to environmental risk can heighten stress, frustration, and conflict within communities.

This project investigates whether environmental risk exposure, measured through flooding-related complaints, is associated with social indicators of anxiety, operationalized as noise complaints across New York City. By utilizing publicly available NYC Open Data, this project demonstrates how open civic data can be used to explore psychological and behavioral patterns at the community level in a reproducible way.

This analysis is framed as a proposal suitable for submission to NYC Open Data Week 2026 and emphasizes transparency, reproducibility, and civic relevance.

8.1 Research Question

How does exposure to environmental risk (measured by flooding complaints) relate to social indicators of anxiety (measured by noise complaints) across New York City boroughs?

8.2 Data Sources

This project uses four datasets from the NYC Open Data Portal:

  1. 311 Service Requests (Noise Complaints subset)
  2. 311 Service Requests (Flooding-related complaints subset)
  3. E-Designations
  4. Hazard Mitigation Plan - Mitigation Actions Database

Due to the size of the full 311 Service Requests dataset, noise complaint data were accessed via the NYC Open Data API. Smaller supporting datasets were downloaded and imported as Excel files. This mixed-format approach improves efficiency while maintaining transparency and reproducibility.

8.3 Reproducible Workflow

Show the code
library(tidyverse)
Warning: package 'tidyr' was built under R version 4.5.2
Warning: package 'readr' was built under R version 4.5.2
Warning: package 'purrr' was built under R version 4.5.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.0     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.2.0     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Show the code
library(lubridate)
library(readxl)
Warning: package 'readxl' was built under R version 4.5.2
Show the code
library(httr)
library(jsonlite)

Attaching package: 'jsonlite'

The following object is masked from 'package:purrr':

    flatten
Show the code
library(knitr)

8.4 Loading Downloaded Excel Datasets

Show the code
library(arrow)
Warning: package 'arrow' was built under R version 4.5.2

Attaching package: 'arrow'
The following object is masked from 'package:lubridate':

    duration
The following object is masked from 'package:utils':

    timestamp
Show the code
edesignation <- read_parquet(
  "E-Designations.parquet",
  na = c("N/A", "NA", "")
)

hazard_mitigation <- read_parquet(
  "Hazard_Mitigation_Plan.parquet",
  na = c("N/A", "NA", "")
)

street_flooding <- read_parquet(
  "Street_Flooding_Complaints.parquet",
  na = c("N/A", "NA", "")
)

8.5 Accessing NYC Open Data via API (311 Noise Complaints)

To avoid downloading the full 311 dataset, noise complaints were retrieved using the NYC Open Data API. Only relevant variables and records were requested.

Show the code
get_nyc_data <- function(url) {
  response <- GET(url)
  content(response, as = "text", encoding = "UTF-8") |>
    fromJSON(flatten = TRUE) |>
    as_tibble()
}
Show the code
noise_url <- URLencode(paste0(
  "https://data.cityofnewyork.us/resource/erm2-nwe9.json?",
  "$select=unique_key,created_date,complaint_type,borough,city,",
  "x_coordinate_state_plane,y_coordinate_state_plane&",
  "$where=complaint_type LIKE 'Noise%' ",
  "AND created_date >= '2018-01-01T00:00:00'&",
  "$limit=50000"
))

noise <- get_nyc_data(noise_url)

8.6 Data Cleaning and Preparation

Data were cleaned to ensure consistent borough labeling and proper date formatting. Complaint counts were aggregated at the borough-year level to allow comparisons across time and location.

Show the code
noise_clean <- noise |>
  filter(!is.na(borough)) |>
  mutate(
    created_date = as.POSIXct(created_date),
    year = year(created_date),
    Borough = borough
  ) |>
  group_by(Borough, year) |>
  summarise(
    noise_complaints = n(),
    .groups = "drop"
  )

flood_clean <- street_flooding |>
  filter(!is.na(Borough)) |>
  mutate(
    created_date = as.POSIXct(`Created Date`),
    year = year(created_date)
  ) |>
  group_by(Borough, year) |>
  summarise(
    flood_complaints = n(),
    .groups = "drop"
  )

8.7 Merging Datasets

Show the code
complaints <- left_join(
  flood_clean,
  noise_clean,
  by = c("Borough", "year")
)

8.8 Descriptive Statistics

Show the code
kable(
  summary(complaints),
  caption = "Descriptive summary of borough-year flooding complaints and noise complaints (after merging datasets)."
)
Table 8.1: Descriptive summary of borough-year flooding complaints and noise complaints (after merging datasets).
Borough year flood_complaints noise_complaints
Length:87 Min. :2010 Min. : 1.0 Min. : 1
Class :character 1st Qu.:2014 1st Qu.: 220.5 1st Qu.: 6
Mode :character Median :2018 Median : 394.0 Median : 124
NA Mean :2018 Mean : 512.8 Mean : 1541
NA 3rd Qu.:2022 3rd Qu.: 765.5 3rd Qu.: 1254
NA Max. :2025 Max. :1571.0 Max. :11767
NA NA NA NA’s :58

This summary provides an overview of variation in environmental risk exposure and social complaint behavior across boroughs and years.

8.9 Visualization 1: Flooding Complaints by Borough

Show the code
ggplot(flood_clean, aes(x = Borough, y = flood_complaints)) +
  geom_col(fill = "#2a9d8f") +
  labs(
    title = "Street Flooding Complaints by Borough",
    x = "Borough",
    y = "Number of Flooding Complaints"
  ) +
  theme_minimal()
Bar chart comparing the total number of street flooding complaints across NYC boroughs. Bar heights show which boroughs report more or fewer flooding complaints.
Figure 8.1: Street flooding complaints by borough (borough-year totals).

8.10 Visualization 2: Flooding and Noise Complaints

Show the code
complaints <- complaints %>%
  mutate(Borough = toupper(trimws(Borough)))
Show the code
ggplot(complaints, aes(x = flood_complaints, y = noise_complaints, color = Borough)) +
  geom_point(size = 3, alpha = 0.7) +
  geom_smooth(method = "lm", se = TRUE, color = "black") +
  scale_color_manual(values = c(
    "MANHATTAN" = "#2a9d8f",
    "BROOKLYN" = "#264653",
    "BRONX" = "#8ac926",
    "QUEENS" = "#56c596",
    "STATEN ISLAND" = "steelblue"
  )) + 
  labs(
    title = "Relationship Between Flooding and Noise Complaints",
    x = "Flooding Complaints",
    y = "Noise Complaints"
  ) +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 58 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 58 rows containing missing values or values outside the scale range
(`geom_point()`).
Scatter plot of borough-year observations with flooding complaints on the x-axis and noise complaints on the y-axis. Points are colored by borough, and a fitted linear trend line summarizes the overall association.
Figure 8.2: Relationship between flooding complaints and noise complaints across borough-years.

8.11 Statistical Analysis

Show the code
model <- lm(noise_complaints ~ flood_complaints, data = complaints)

summary(model)

Call:
lm(formula = noise_complaints ~ flood_complaints, data = complaints)

Residuals:
    Min      1Q  Median      3Q     Max 
-1624.4 -1500.7 -1387.5  -242.6 10265.6 

Coefficients:
                  Estimate Std. Error t value Pr(>|t|)
(Intercept)      1468.0383   871.8717   1.684    0.104
flood_complaints    0.1217     1.1618   0.105    0.917

Residual standard error: 2819 on 27 degrees of freedom
  (58 observations deleted due to missingness)
Multiple R-squared:  0.0004065, Adjusted R-squared:  -0.03662 
F-statistic: 0.01098 on 1 and 27 DF,  p-value: 0.9173

8.12 Results

The regression analysis evaluates whether higher levels of flooding complaints are associated with increased noise complaints. A positive relationship would align with environmental stress theory, suggesting that climate-related disruptions may be linked to heightened social tension and anxiety-related behaviors.

8.13 Discussion

This project demonstrates how climate-related environmental stressors may influence social behavior in urban environments. Flooding represents a tangible, recurring disruption, while noise complaints may reflect increased frustration or conflict within communities. Together, these indicators provide insight into how climate risk may shape everyday social experiences in New York City.

By integrating psychological theory with open civic data, this analysis highlights the value of interdisciplinary approaches to understanding climate impacts.

8.14 Limitations and Future Directions

311 complaint data reflect reporting behavior rather than direct psychological measurement and may vary by access to city services or trust in government. Future work could incorporate demographic or spatial analyses, examine temporal patterns around extreme weather events, or integrate measures of pro-environmental behavior and peer influence.

8.15 Connection to Open Data

This project emphasizes transparency and reproducibility by combining downloaded open datasets with API-based data access. NYC Open Data enables researchers and communities to explore complex environmental and social issues using publicly accessible information, supporting informed decision-making and civic engagement.

8.16 Conclusion

Environmental stressors associated with climate change may have meaningful social and psychological consequences in urban settings. Using NYC Open Data, this project provides a reproducible framework for examining how environmental risk relates to social indicators of anxiety across New York City. These findings underscore the importance of incorporating psychological perspectives into climate resilience planning.