Amounts and proportions
The New York City Department of Buildings (DOB) maintains a list of construction sites that have been categorized as “essential” during the city’s shelter-in-place pandemic order. They’ve provided an interactive map here where you can see the different projects. There’s also a link there to download the complete dataset.
For this exercise, you’re going to use this data to visualize the amounts or proportions of different types of essential projects in the five boroughs of New York City (Brooklyn, Manhattan, the Bronx, Queens, and Staten Island).
You’ll be doing all your R work in R Markdown this time (and from now on). You should use an RStudio Project to keep your files well organized (either on your computer or on RStudio.cloud). Either create a new project for this exercise only, or make a project for all your work in this class.
You’ll need to download one CSV file and put it somewhere on your computer or upload it to RStudio.cloud—preferably in a folder named
data in your project folder. You can download the data from the DOB’s map, or use this link to get it directly:
To help you, I’ve created a skeleton R Markdown file with a template for this exercise, along with some code to help you clean and summarize the data. Download that here and include it in your project:
In the end, the structure of your project directory should look something like this:
your-project-name\ 04-exercise.Rmd your-project-name.Rproj data\ EssentialConstruction.csv
To check that you put everything in the right places, you can download and unzip this file, which contains everything in the correct structure:
Task 1: Reflection
Write your reflection for the day’s readings.
Task 2: Essential pandemic construction
Make the following plots and briefly explain what they show:
Show the count or proportion of approved projects by borough using a bar chart
Show the count or proportion of approved projects by category using a lollipop chart
Show the proportion of approved projects by borough and category simultaneously using a heatmap
The example for today’s session will be incredibly helpful for this exercise. Reference it.
You don’t need to make these super fancy, but if you’re feeling brave, experiment with adding a
labs() layer or changing fill colors with
scale_fill_manual() or with viridis palettes.
You’ll need to insert your own code chunks where needed. Rather than typing them by hand (that’s tedious and you might miscount the number of backticks!), use the “Insert” button at the top of the editing window, or type ctrl + alt + i on Windows, or ⌘ + ⌥ + i on macOS.
Turning everything in
When you’re all done, click on the “Knit” button at the top of the editing window and create an HTML or Word version (or PDF if you’ve installed tinytex) of your document. Upload that file to iCollege.