9 RMarkdown, Shiny, and NYC 311 Data

9.1 Chapter Introduction

In this assignment, we explore New York City’s 311 service request data to better understand patterns in complaints across boroughs. The goal is to identify which boroughs generate the most complaints and to examine the most common complaint types within each borough.

This chapter demonstrates skills in:

  1. Accessing and retrieving public data using the nycOpenData package.
  2. Data manipulation and summarization with tidyverse.
  3. Interactive data visualization using Shiny inputs and reactive outputs.

By combining descriptive statistics with interactive plots, readers can dynamically explore patterns in complaints across the city.

9.2 311 Data Exploration

9.3 Introduction

Today, we are going to be exploring the amazing 311 dataset as part of the nycOpenData package, specifically the nyc_311 function from that package.

We will be looking at the 311 dataset, specifically which boroughs have the most complaints and what the top complaints in each borough is.

9.4 Loading our libraries

Here we are going to make sure that all of our libraries are loaded.

9.5 Calling our data

Now that we have loaded our libraries, lets get our data

data_311<- nyc_311(limit = 10000)

9.6 Inputs and Outputs

You can embed Shiny inputs and outputs in your document. Outputs are automatically updated whenever inputs change. This demonstrates how a standard R plot can be made interactive by wrapping it in the Shiny renderPlot function. The selectInput and sliderInput functions create the input widgets used to drive the plot.