STA 9750
  • Syllabus
  • Pre-Assignments
  • Labs
  • Mini Projects
  • Course Project
  • Additional Resources and Course Policies
  • Learning Objectives
  • Prior Offerings
    • Spring 2026
    • Fall 2025
    • Spring 2025
    • Fall 2024

Warning - This page is for a prior offering of STA 9750. For the latest offering, click here.

On this page

  • Key Dates
  • Introduction
    • Student Responsibilities
    • Rubric
    • Submission Instructions
  • Mini-Project #03: Where My People At?
    • Data Acquisition
    • Data Cleaning and Preparation
    • Data Integration and Initial Exploration
    • Final Deliverable: Atlas of Communities Entry
  • AI Usage Statement
  • Extra Credit Opportunities
    • Extra Credit Opportunity #01: Interactive Graphics
    • Extra Credit Opportunity #02: Additional Census Tables
  • Edit this page
  • View source
  • Report an issue

STA 9750 Mini-Project #03: Where My People At?

\[\newcommand{\P}{\mathbb{P}} \newcommand{\E}{\mathbb{E}} \newcommand{\R}{\mathbb{R}}\]

Key Dates

  • Released to Students: 2026-11-05
  • Initial Submission: 2026-11-27 11:59pm ET on GitHub and Brightspace
  • Peer Feedback:
    • Peer Feedback Assigned: 2026-11-30 on GitHub
    • Peer Feedback Due: 2026-12-07 11:59pm ET on Brightspace
  • Estimated Return of Grades and Comments:
    • Initial Submission: 2026-12-11
    • Meta-Review: 2026-12-15

Estimated Time to Complete: 13-15 Hours

Estimated Time for Peer Feedback: 1 Hour


Introduction

Welcome to Mini-Project #03! In this mini-project, we will explore patterns of population density within the United States, with an eye towards identifying pockets of high density1 within the US and important ethnic enclaves. You are a freelance travel writer who has been hired to write an entry for a new travel publication, Welcomed by the New Colossus: An Atlas of American Communities. Specifically, the editors have asked you to write a two part story about a demographic group of interest to you: they have given you full discretion to pick the topic, but they want you to discuss both where that ethnic group lives in NYC and where they have concentrated in the broader USA.

NoteChoice of Demographic Group

Despite the title of this assignment, you are not required to focus on a demographic group with which you identify. Feel free to use any demographic group and to disclose as much or as little about yourself as you feel comfortable with while completing this assignment.

Your analysis will principally rely on data from the American Community Survey (ACS), the long-running premier national survey conducted by the US Census Bureau. Unlike the decadal census, which occurs once every ten years, the ACS is constantly collecting new data, giving a up-to-date picture of the American public. ACS data is released across a range of granularities, from national averages to small census-block level estimates. High-level estimates, e.g., those for the country as a whole or individual states, are published on a year-by-year basis, in a data product often called “ACS-1” since they are derived from samples taken in a one-year window. In order to preserve respondent privacy and ensure statistical reliability at finer scales, ACS estimates for smaller regions are published based on a rolling five-year window: these estimates are known as “ACS-5”.2 Larger regions are also available from ACS-5 to avoid alignment issues, but these are a bit less useful to us.

We will combine ACS estimates with data on NYC’s built environment, available to us via PLUTO (Primary Land Use Tax Output), NYC’s primary database of buildings. By giving us additional information about the number of residential units and the total residential square footage within each census block, this will allow us to better understand how population density and demographic concentration relate to residential density in NYC.

Student Responsibilities

Recall our basic analytic workflow and table of student responsibilities:

  • Data Ingest and Cleaning: Given a data source, read it into R and transform it to a reasonably useful and standardized (‘tidy’) format.
  • Data Combination and Alignment: Combine multiple data sources to enable insights not possible from a single source.
  • Descriptive Statistical Analysis: Take a data table and compute informative summary statistics from both the entire population and relevant subgroups
  • Data Visualization: Generate insightful data visualizations to spur insights not attainable from point statistics
  • Inferential Statistical Analysis and Modeling: Develop relevant predictive models and statistical analyses to generate insights about the underlying population and not simply the data at hand.

In this course, our primary focus is on the first four stages: you will take other courses that develop analytical and modeling techniques for a variety of data types. As we progress through the course, you will eventually be responsible for the first four steps. Specifically, you are responsible for the following stages of each mini-project:

Students’ Responsibilities in Mini-Project Analyses
Ingest and Cleaning Combination and Alignment Descriptive Statistical Analysis Visualization
Mini-Project #01 ✓
Mini-Project #02 ✓ ✓ ½
Mini-Project #03 ½ ✓ ✓ ✓
Mini-Project #04 ✓ ✓ ✓ ✓

In this project, I am no longer providing code to download and read the necessary data files. The data files I have selected for this mini-project are relatively easy to work with and should not provide a significant challenge, particularly after our in-class discussion of Data Import.

Rubric

STA 9750 Mini-Projects are evaluated using peer grading with meta-review by the course staff (GTAs and the instructor). The following basic rubric will be used for all mini-projects:

Course Element Excellent (9-10) Great (7-8) Good (5-6) Adequate (3-4) Needs Improvement (1-2)
Written Communication Report is very well-written and flows naturally. Motivation for key steps is clearly explained to reader without excessive detail. Key findings are highlighted and appropriately given sufficient context, including reference to related work where appropriate. Report has no grammatical or writing issues.3 Writing is accessible and flows naturally. Key findings are highlighted and clearly explained, but lack suitable motivation and context. Report has no grammatical or writing issues. Key findings are present but insufficiently highlighted or unclearly explained. Writing is intelligible, but has some grammatical errors. Key findings are difficult to discern. Report exhibits significant weakness in written communication. Key points are nearly impossible to identify.
Project Skeleton Code completes all instructor-provided tasks correctly. Responses to open-ended tasks are especially insightful and creative. Code completes all instructor-provided tasks satisfactorily. Responses to open-ended tasks are insightful, creative, and do not have any minor flaws. Response to one instructor provided task is skipped, incorrect, or otherwise incomplete. Responses to open-ended tasks are solid and without serious flaws. Responses to two instructor provided tasks are skipped, incorrect, or otherwise incomplete. Responses to open-ended tasks are acceptable, but have at least one serious flaw. Response to three or more instructor provided tasks are skipped, incorrect, or otherwise incomplete. Responses to open-ended tasks are seriously lacking.
Tables & Document Presentation Tables go beyond standard publication-quality formatting, using advanced features like color formatting, interactivity, or embedded visualization. Tables are well-formatted, with publication-quality selection of data to present, formatting of table contents (e.g., significant figures) and column names. Tables are well-formatted, but still have room for improvement in one of these categories: subsetting and selection of data to present, formatting of table contents (e.g., significant figures), column names. Tables lack significant ‘polish’ and need improvement in substance (filtering and down-selecting of presented data) or style. Document is difficult to read due to distracting formatting choices. Unfiltered ‘data dump’ instead of curated table. Document is illegible at points.
Data Visualization Figures go beyond standard publication-quality formatting, using advanced features like animation, interactivity, or advanced plot types implemented in ggplot2 extension packages. Figures are ‘publication-quality,’ with suitable axis labels, well-chosen structure, attractive color schemes, titles, subtitles, and captions, etc. Figures are above ‘exploratory-quality’ and reflect a moderate degree of polish, but do not reach full ‘publication-quality’ in one-to-two ways. Figures are above ‘exploratory-quality’ and reflect a moderate degree of polish, but do not reach full ‘publication-quality’ in three or more distinct ways. Figures are suitable to support claims made, but are ‘exploratory-quality,’ reflecting zero-to-minimal effort to customize and ‘polish’ beyond ggplot2 defaults.
Exploratory Data Analysis Deep and ‘story-telling’ EDA identifying non-obvious patterns that are then used to drive further analysis in support of the project. All patterns and irregularities are noted and well characterized, demonstrating mastery and deep understanding of all data sets used. Meaningful ‘story-telling’ EDA identifying non-obvious patterns in the data. Major and pinor patterns and irregularities are noted and well characterized at a level sufficient to achieve the goals of the analysis. EDA demonstrates clear understanding of all data sets used. Extensive EDA that thoroughly explores the data, but lacks narrative and does not deliver a meaningful ‘story’ to the reader. Obvious patterns or irregularities noted and well characterized, but more subtle structure may be overlooked or not fully discussed. EDA demonstrates competence and basic understanding of the data sets used. Solid EDA that identifies major structure to the data, but does not fully explore all relevant structure. Obvious patterns or irregularities ignored or missed. EDA demonstrates familiarity with high-level structure of the data sets used. Minimal EDA, covering only standard summary statistics, and providing limited insight into data patterns or irregularities. EDA fails to demonstrate familiarity with even the most basic properties of the data sets being analyzed.

Code Quality

Code is (near) flawless. Intent is clear throughout and all code is efficient, clear, and fully idiomatic.

Code passes all styler and lintr type analyses without issue.

Comments give context and structure of the analysis, not simply defining functions used in a particular line. Intent is clear throughout, but code can be minorly improved in certain sections.

Code has well-chosen variable names and basic comments. Intent is generally clear, though some sections may be messy and code may have serious clarity or efficiency issues.

Code executes properly, but is difficult to read. Intent is generally clear and code is messy or inefficient.

Code fails to execute properly.

Data Preparation Data import is fully-automated and efficient, taking care to only download from web-sources if not available locally. All data cleaning steps are fully-automated and robustly implemented, yielding a clean data set that can be widely used. Data is imported and prepared effectively, in an automated fashion with minimal hard-coding of URLs and file paths. Data cleaning is fully-automated and sufficient to address all issues relevant to the analysis at plan. Data is imported and prepared effectively, though source and destination file names are hard-coded. Data cleaning is rather manual and hard-codes most transformations. Data is imported in a manner likely to have errors. Data cleaning is insufficient and fails to address clear problems. Data is hard-coded and not imported from an external source.
Analysis and Findings Analysis demonstrates uncommon insight and quality, providing unexpected and subtle insights. Analysis is clear and convincing, leaving essentially no doubts about correctness. Analysis clearly appears to be correct and passes the “sniff test” for all findings, but a detailed review notes some questions remain unanswered. Analysis is not clearly flawed at any point and is likely to be within the right order of magnitude for all findings. Analysis is clearly incorrect in at least one major finding, reporting clearly implausible results that are likely off by an order of magnitude or more.

Note that the “Excellent” category for most elements applies only to truly exceptional “above-and-beyond” work. Most student submissions will likely fall in the “Good” to “Great” range.

At this point, you are responsible for the ‘Data Preparation’ portion of the project, but I am still providing a set of basic EDA activities. Accordingly, reports completing all tasks described under Data Integration and Exploration below should receive an automatic 10/10 for the ‘Exploratory Data Analysis’ rubric element.

Taken together, you are only really responsible for these portions of the rubric in this assignment:

  • Written Communication
  • Project Skeleton
  • Tables & Document Presentation
  • Data Visualization
  • Code Quality
  • Data Preparation
  • Analysis and Findings

Reports completing all key steps outlined below essentially start with 10 free points.

For this mini-project, no more than 6 total points of extra credit can be be awarded. Opportunities for extra credit exist for students who go above and beyond the instructor-provided scaffolding. Specific opportunities for extra credit can be found below.

Students pursuing careers in data analytics are strongly encouraged to go beyond the strict ambit of the mini-projects to

  1. further refine their skills;
  2. learn additional techniques that can be used in the final course project; and
  3. develop a more impressive professional portfolio.

Because students are encouraged to use STA 9750 mini-projects as the basis for a professional portfolio, the basic skeleton of each project will be released under a fairly permissive usage license. Take advantage of it!

Submission Instructions

After completing the analysis, write up your findings, showing all of your code, using a dynamic quarto document and post it to your course repository. The qmd file should be named mp03.qmd (lower case!) so the rendered document can be found at docs/mp03.html in the student’s repository and will be served at the URL:4

https://YOUR_GITHUB_ID.github.io/STA9750-2026-FALL/mp03.html

You can use the helper function mp_start available at in the Course Helper Functions to create a file with the appropriate name and some meta-data already included. Do so by running the following command at the R Console:

source("https://michael-weylandt.com/STA9750/load_helpers.R"); mp_start(N=03)

After completing this mini-project, upload your rendered output and necessary ancillary files to GitHub to make sure your site works. The mp_submission_ready function in the Course Helper Functions can perform some of these checks automatically. You can run this function by running the following commands at the R Console:

source("https://michael-weylandt.com/STA9750/load_helpers.R"); mp_submission_ready(N=03)

Once you confirm this website works (substituting YOUR_GITHUB_ID for the actual GitHub username provided to the professor in MP#00 of course), open a GitHub issue on the instructor’s repository to submit your completed work.

The easiest way to do so is by use of the mp_submission_create function in the Course Helper Functions, which can be used by running the following command at the R Console:

source("https://michael-weylandt.com/STA9750/load_helpers.R"); mp_submission_create(N=03)

Alternatively, if you wish to submit manually, open a new issue at

https://github.com/michaelweylandt/STA9750-2026-FALL/issues/new .

Title the issue STA 9750 YOUR_GITHUB_ID MiniProject #03 and fill in the following text for the issue:

Hi @michaelweylandt!

I've uploaded my work for MiniProject #**03** - check it out!

<https://YOUR_GITHUB_ID.github.io/STA9750-2026-FALL/mp03.html>

At various points before and after the submission deadline, the instructor will run some automated checks to ensure your submission has all necessary components. Please respond to any issues raised in a timely fashion as failing to address them may lead to a lower set of scores when graded.

Additionally, a PDF export of this report should be submitted on Brightspace. To create a PDF from the uploaded report, simply use your browser’s ‘Print to PDF’ functionality.

NB: The analysis outline below specifies key tasks you need to perform within your write up. Your peer evaluators will check that you complete these. You are encouraged to do extra analysis, but the bolded Tasks are mandatory.

NB: Your final submission should look like a report, not simply a list of facts answering questions. Add introductions, conclusions, and your own commentary. You should be practicing both raw coding skills and written communication in all mini-projects. There is little value in data points stated without context or motivation.

Mini-Project #03: Where My People At?

CautionLongest Mini-Project of the Semester

NB: This is potentially the longest mini-project of the semester. Mini-Project #04 will be shorter to give you sufficient time to complete your course project successfully. Unlike the previous two mini-projects, you are responsible for data import and cleaning in this project. Though this isn’t glamorous, this is the aspect of data analysis that typically requires the most time and effort and you should plan accordingly.

Data Acquisition

When downloading data from a web-based resource, it is important to be a polite and responsible user of that resource. Specifically, we want to avoid excessively and repeatedly re-downloading a file if it is not changing. Running a public data source is costly and downloading a file 1,000 times when you only need it once is simply abusing the good will of others.

We can ensure responsible usage by adopting a practice of file caching:

  • Create a “data directory” where data files relevant to the project can be stored
  • When attempting to load a data resource, first see if the relevant file is in the data directory:
    • If the file is in the data directory, simply read and return the contents of that file to the user
    • If the file is not in the data directory, download it into the data directory and save a permanent copy for later use before reading and returning the contents of the file to the user.

This process of “saving” an intermediate result (data file) to avoid an expensive step (downloading) is known as caching. Here, in addition to reducing load on the data server, caching will also make your analysis faster (as you can avoid download times) and allow you to work even when you don’t have reliable internet access.

Review the data download code I provided you in MP#01 and MP#02 to see how I implemented caching there. You should adopt similar patterns for this assignment. In particular, you should consistently:

  1. Check if the results are available locally
  2. If results are not available locally, download and save to a local file
  3. Read results from the saved local file

Note that this pattern should be used for all data access, even if it’s via a package like tidycensus. In addition to being polite, it will also make your analysis run more quickly as you will not be constantly re-downloading large data files. While it is possible to save your results in specialized R data files, I recommend using open and transparent standards like csv (readr::read_csv()) and shp (sf::write_sf()) as appropriate.

Population Variables - Package Usage

Census data is very high-quality, but accessing it can be somewhat tricky The census reports data in the form of “tables” which have systematic, but difficult to interpret identifiers. We can access these using the get_acs() function from the tidycensus package, which works like this:

library(tidycensus)
library(gt)

ny_income <- get_acs(
    c(median_household_income="B19013_001"), 
    state="NY", 
    geography="county", 
    year=2018, 
    survey="acs1"
)

In this case, B19013 is the table “Median Household Income in the Past 12 Months (in YYYY Inflation-Adjusted Dollars)” and the suffix “001” indicates that we want the first row of the table. Here, we asked for results from the 2018 ACS-1 county-level estimates for New York State. After some basic formatting, we get the following results, which can be verified against the Census Data Explorer website:

GEOID NAME Median Household Income
Highest Median Household Income Counties
36059 Nassau County, New York $116,304
36079 Putnam County, New York $102,525
36103 Suffolk County, New York $100,468
36119 Westchester County, New York $94,811
36087 Rockland County, New York $89,812
Lowest Median Household Income Counties
36007 Broome County, New York $51,125
36089 St. Lawrence County, New York $49,681
36009 Cattaraugus County, New York $48,179
36013 Chautauqua County, New York $45,479
36005 Bronx County, New York $38,467

Here, the GEOID, also known as the FIPS code, is a unique identifier used for different administrative units with the US (so states, counties, cities, etc all have distinct GEOIDs). Note that I’m only showing the top and bottom 5 counties here for brevity.

Unfortunately, relevant ancestry information is spread across several census tables that can be a bit difficult to use, including:

  • B04006 useful for European, Carribean, and African ancestries. The sub-tables are listed at https://api.census.gov/data/2021/acs/acs1/groups/B04006.html. After picking a demographic group of interest based on the Label column, use the Name value, without the final letters (E, EA, M) for the variables argument to get_acs().
  • B02018 useful for Asian ancestries. The sub-tables are listed at https://api.census.gov/data/2021/acs/acs1/groups/B02018.html. After picking a demographic group of interest based on the Label column, use the Name value, without the final letters (E, EA, M) for the variables argument to get_acs().
  • B03001 useful for Latino ancestries. The sub-tables are defined at https://api.census.gov/data/2021/acs/acs1/groups/B03001.html. After picking a demographic group of interest based on the Label column, use the Name value, without the final letters (E, EA, M) for the variables argument to get_acs().

We can use these to compute the percent of residents of various NY counties reporting certain ethnicities:

get_acs(
    geography = "county",
    variables = c(
        korean = "B02018_005",
        irish="B04006_049",
        mexican="B03001_004",
        total = "B01003_001"
    ),
    state = "NY",
    year = 2024,
    survey = "acs5",
    output = "tidy"
) |>
    select(-moe) |> 
    pivot_wider(names_from=variable, values_from=estimate)

which gives the following:

County Total Population Korean-American Mexican-American Irish-American
Kings County, New York 2,631,580 16,213 (0.62%) 103,780 (3.94%) 105,150 (4.00%)
Queens County, New York 2,323,052 49,769 (2.14%) 95,047 (4.09%) 84,576 (3.64%)
New York County, New York 1,629,477 21,063 (1.29%) 41,385 (2.54%) 115,392 (7.08%)
Suffolk County, New York 1,530,146 6,257 (0.41%) 23,547 (1.54%) 247,260 (16.16%)
Bronx County, New York 1,404,779 2,121 (0.15%) 81,362 (5.79%) 23,725 (1.69%)
Nassau County, New York 1,389,591 16,841 (1.21%) 15,761 (1.13%) 161,822 (11.65%)
Westchester County, New York 999,677 7,678 (0.77%) 38,726 (3.87%) 107,664 (10.77%)
Erie County, New York 950,622 2,594 (0.27%) 7,619 (0.80%) 149,073 (15.68%)
Monroe County, New York 753,753 3,138 (0.42%) 5,217 (0.69%) 107,104 (14.21%)
Richmond County, New York 494,956 2,836 (0.57%) 19,466 (3.93%) 43,684 (8.83%)

If we want to extend to the ten most populous counties in the US as a whole, we can pass state.abb (the 50 state codes) to the state argument of get_acs():

get_acs(
    geography = "county",
    variables = c(
        korean = "B02018_005",
        irish="B04006_049",
        mexican="B03001_004",
        total = "B01003_001"
    ),
    state = state.abb,
    year = 2024,
    survey = "acs5") |>
    select(-moe) |> 
    pivot_wider(names_from=variable, values_from=estimate)

which gives the following:

County Total Population Korean-American Mexican-American Irish-American
Los Angeles County, California 9,808,667 224,745 (2.29%) 3,458,834 (35.26%) 370,162 (3.77%)
Cook County, Illinois 5,182,090 43,895 (0.85%) 1,043,055 (20.13%) 432,999 (8.36%)
Harris County, Texas 4,838,303 18,139 (0.37%) 1,435,623 (29.67%) 195,678 (4.04%)
Maricopa County, Arizona 4,559,748 23,063 (0.51%) 1,201,081 (26.34%) 400,177 (8.78%)
San Diego County, California 3,288,774 31,372 (0.95%) 975,588 (29.66%) 255,722 (7.78%)
Orange County, California 3,165,820 118,261 (3.74%) 897,450 (28.35%) 190,775 (6.03%)
Miami-Dade County, Florida 2,738,356 3,033 (0.11%) 59,352 (2.17%) 36,637 (1.34%)
Kings County, New York 2,631,580 16,213 (0.62%) 103,780 (3.94%) 105,150 (4.00%)
Dallas County, Texas 2,621,179 11,045 (0.42%) 846,286 (32.29%) 115,742 (4.42%)
Riverside County, California 2,478,600 14,161 (0.57%) 1,090,978 (44.02%) 131,317 (5.30%)

Note how we could use a named vector as the first argument to get_acs() lets us control the name the result is given in R. get_acs() has two additional features that will be useful:

  • the ability to automatically download shapefile information associated with each result;
  • the ability to cache results automatically. (Recent versions of tidycensus have disabled the built-in caching. You should instead save your results to a local and implement manual caching.)

You will want to use both of these in this assignment.

TipTask 0: Data Acquisition - Census API Key

Fill out the form at https://api.census.gov/data/key_signup.html to get a free Census Data API Key. Record its value and then run

tidycensus::census_api_key("YOUR_KEY_HERE", install=TRUE)

in R to store it appropriately. Once you do this, you will be able to access the advanced functionality of the tidycensus package. You should only need to do this one time, so do not record your API key in your qmd file. (It is your private information, akin to a password!)

TipTask 1: Data Acquisition - CBSA Population Breakdown

Use the get_acs() function from the tidycensus package to acquire CBSA-level (geography="cbsa") estimates of total population (B01003_001) and a population of interest to you based on the latest5 ACS-1 or ACS-5.6 You may or may not need the geometry (shape file) data here, depending on how you perform your analysis below, but if you wind up needing it, make sure to download it here. Read the help page for get_acs() to identify the shape file download arguments.

Make sure to cache your results as described above.

TipTask 2: Data Acquisition - NYC Tract Population Breakdown

Use the get_acs() function from the tidycensus package to acquire census tract-level (geography="tract") estimates of total population (B01003_001) and a population of interest to you based on the latest ACS-5. You will need the geometry (shape file) data here so make sure to download it here.

Read the help page for get_acs() to identify the shape file download arguments.

Make sure to cache your results as described above.

NYC Neighborhoods - File Download

For the second part of our analysis, where we look at patterns within NYC, we will need to map census data to more interpretable neighborhoods. The NYC government recognizes approximately 250 neighborhoods as its official Neighborhood Tabulation Areas. A shape file containing this information can be found at https://www.nyc.gov/content/planning/pages/resources/datasets/neighborhood-tabulation. Specifically, the first “Download Files” button just under 2020 Neighborhood Tabulation Areas (NTAs).

TipTask 3: Data Acquisition - NYC NTAs

Write a function load_nyc_nta() which downloads the NTA shapefile, unzips it, and reads it into R as an sf object. Your function should:

  1. Create the directory data/mp03 if it does not already exist. (See previous MPs for examples of how this is done.)

  2. Check if the NTA data is present in the data/mp03 directory and, if it is not, download it using the download.file() function or the httr2 package.

  3. Unzip the downloaded zip file into a directory using the unzip() function.

  4. Read the shp file in the unzipped directory into R using the st() function from the sf package.

  5. Remove columns which you will not find helpful.

  6. Return the sf object to the caller.

CautionDo Not Use tidycensus for NYC NTAs

It may be possible to get NTA level data and geometries using the tidycensus package: Do not use tidycensus to access this data. You must use generic tools like the download.file() function or the httr2 (not httr) package.

The point of this portion is to practice getting data for which an easy wrapper is not available. Use of tidycensus to access migration data will receive an automatic 0 for the “Data Preparation” portion of this mini-project and significant penalization on the “Project Skeleton” portion.

Aggregating Tract Data to NTAs

Now that you have NYC’s NTA map, we can aggregate our population counts from tract level to neighborhood level. To do this, we need to join these two data sets together, but this is not a typical join. Because our join is based on ‘is this tract in this NTA?’ rather than (scalar) equality, we need to use a spatial join, which we implement via the sf::st_join function. This join requires a slightly different syntax, including specification of the ‘check’ used to align rows:

  • st_contains: Does the spatial region in the first table contain the points in the second table? (Regions first argument, points second argument)
  • st_intersects: Does a point from the first table fall in a region from the second table? (Points first argument, regions second argument)

These functions are passed (without parentheses or any arguments) as the join argument of st_join. Either of these can work for this step; you simply need to make sure you’re passing the join that corresponds to the order of the tables. A naive join, however, can result in too many rows if a tract crosses multiple NTAs. (This is likely as the Census and the City do not coordinate these boundaries.) We will instead just assign each tract to the NTA with which it has the largest intersection, using the largest=TRUE argument to st_join.

After joining these data sets, we can use st_drop_geometry() to temporarily drop the geometry and summarize our data as usual.7 Finally, we can join our summarized census data with our original NTA data to connect it back to the shape information.

TipTask 4: Aggregate Tract Data to the NTA Level

Following the strategy above, aggregate your census tract population variables to the NTA level. Make sure that you ‘reconnect’ these aggregate values to the NTA geometry for later use.

NYC PLUTO - API Usage

Finally, we need to download the PLUTO data from NYC OpenData using the provided API. To access this API, click “Export” near the top right corner of the page, then select “API endpoint”, “Data Format: CSV”, and “Version: SODA2” to get the base URL for this API.

By default, if you simply download directly from that URL you will only get the first 1000 rows in the data set. To download the full data set, you will need to adjust the $limit and $offset parameters in your API call. The

  • $limit controls the number of results returned per query. It defaults to 1000, but can be set much larger than this. Note that you do not necessarily want to set $limit too large as this decreases download times and increases the chance of corruption or time-outs during download.

  • $offset adjusts the results returned from a query. It defaults to 0, returning items 1 to 1000 (at the default $limit of 1000). If you set $offset to 1000, you will instead retrieve rows 1001 to 2000 (at the default $limit of 1000). By iteratively adjusting $offset, you can “page through” the entire data set.

    If there are not $limit results remaining, you will get only as many results as can be returned after the offset. So, in a data set of 1500 observations, a query with $limit=1000 and $offset=1000 will return rows 1001 to 1500. The fact that this is less than $limit can be used to identify the end of the data set.

Using these two query parameters you will be able to download the NYC PLUTO data responsibly.

TipTask 5: Download PLUTO

Write a function to download the NYC PLUTO data correctly, completely and responsibly. When this function is called, it should

  1. Check if the data is already available locally and use the cached copy if available.
  2. Download the PLUTO data in a paginated fashion using the two API parameters listed above.
  3. Combine all API responses using the bind_rows() function from the dplyr package.
  4. Save the combined data set as a csv for later use that can be read with readr::read_csv()

Feel free to save only those columns of the PLUTO data that you will need for later analyses. Alternatively, keep them all in your cached csv, but only read in necessary columns using the col_select argument to readr::read_csv().

Hint: This old Mini-Project may be helpful.

Data Cleaning and Preparation

You should have completed your data cleaning as part of the import steps above. While it is generally good to “spot check” data for accuracy, in this case we can trust the Census Bureau and NYC and move immediately to EDA, only performing additional checks if issues are identified.

Data Integration and Initial Exploration

TipTask 6: Exploratory Data Analysis

Answer the following questions to perform your Exploratory Data Analysis of the various data sets used in this project. For each question, answer using inline values, a table, or a graphic as you feel is most effective, though you should plan to have at least: 2 tables, 2 inline values, 1 non-spatial plot, 1 spatial plot among your several answers.

Note that you will need to determine which data sets are best suited to answer each question and may need to return to earlier steps and acquire more data:8 some questions might require joining multiple data sets to answer fully.

  1. Which NYC census tract has the most office floor area in NYC?

    Hint: Use the bct2020 column of the PLUTO data to get census tract ID and the officearea column to get office area. I think you can safely treat NA values in office area as 0s.

  2. Which NYC NTA has the most residential units (unitsses in PLUTO)?

  3. Which NYC census tract has the highest population density, measured as population per square foot of residential space? Do your answers change if you measure by population per residential unit?

  4. What 5 metro areas, other than NYC, have the largest share of population that identify with your ancestry of interest?

  5. At a not-too-granular level, describe the distribution of ancestries in a large non-NYC city of your choosing from the previous question.

  6. As a percentage of all US residents who identify with your ancestry of interest, how many live in NY and how many live in other major metro areas?

    Hint: get_acs(geography="us") will be helpful to get the denominator here.

  7. Do we observe a roughly linear relationship between population and housing (units or area) across NYC tracts or is the relationship more complex?

  8. What are the NTAs with highest buildings? (You can use PLUTO’s numfloors variable as a measure of height. You don’t need to get actual physical measurements.)

  9. Visualize how population density varies across NYC?

  10. How many New Yorkers live in areas that could be described as ‘primarily commercial’? (This one is particularly open-ended.)

Final Deliverable: Atlas of Communities Entry

Now that your data is fully prepared, it’s time to write your entry for Welcomed by the New Colossus. Write an overview and brief story about “X”-Americans, discussing where they live in NYC and where they can be found throughout the US. Your write up should include at least 4 numerical facts and two maps of your choosing. (These can be, but are not required to be, related to the EDA performed above.) Make sure to include relevant historical context as well. This should be at least 300 words, but you can use more if you have more information to add.

TipTask 7: Atlas of American Communities Entry

Write up your entry for the Atlas of American Communities. It should contain (at least) the items noted above, but you can have as much fun with this and go as deep into the subject as you want.

AI Usage Statement

At the end of your report, you must include a description of the extent to which you used Generative AI tools to complete the mini-project. This should be a one paragraph section clearly deliniated using a collapsable Quarto “Callout Note”. Failure to include an AI disclosure will result in an automatic 25% penalty.

E.g.,

NoteAI Usage Statement

No Generative AI tools were used to complete this mini-project.

or

NoteAI Usage Statement

GitHub Co-Pilot Pro was used via RStudio integration while completing this project. No other generative AI tools were used.

or

NoteAI Usage Statement

ChatGPT was used to help write the code in this project, but all non-code text was generated without the use of any Generative AI tools. Additionally, ChatGPT was used to provide additional background information on the topic and to brainstorm ideas for the final open-ended prompt.

Recall that Generative AI may not be used to write or edit any non-code text in this course.

These blocks should be created using the following syntax:


::: {.callout-note title="AI Usage Statement" collapse="true"}

Your text goes here. 

:::

Make sure to use this specific type of callout (.callout-note), title, and collapse="true" setting.

Please contact the instructor if you have any questions about appropriate AI usage in this course.

Extra Credit Opportunities

There are optional Extra Credit Opportunities where extra points can be awarded for specific additional tasks in this mini-project. The amount of the extra credit is typically not proportional to the work required to complete these tasks, but I provide these for students who want to dive deeper into this project and develop additional data analysis skills not covered in the main part of this mini-project.

For this mini-project, no more than 6 total points of extra credit may be awarded. Even with extra credit, your grade on this mini-project cannot exceed 80 points total.

Extra Credit Opportunity #01: Interactive Graphics

Possible Extra Credit: Up to 3 Points

One point of extra credit will be awarded to submissions that make effective use of the “interactive” functionality afforded by the ggiraph package in a standard (non-map) graph; an additional point of extra credit will be awarded for use of interactive functionality on a map. (See Lab #07 for examples.) A final (third) point of extra credit will be awarded for effective visualizations that use the data_id functionality in conjunction with the patchwork package to link across different panels in a visualization.

Extra Credit Opportunity #02: Additional Census Tables

Possible Extra Credit: Up to 3 Points

Up to three points of extra credit will be awarded for analyses that use additional (non-ancestry) census data tables in a manner that enriches your final write up.

The Census Data Explorer can help you find relevant tables, but your favorite LLM will likely be more effective than trying to navigate through the census tables directly. I would however, strongly advise you to cross-check things. The specific census table codes are not the kind of data that is well-represented in LLM training data and I have found them to be wrong with surprising regularity.


This work ©2026 by Michael Weylandt is licensed under a Creative Commons BY-NC-SA 4.0 license.

Footnotes

  1. Not surprisingly, NYC has many of the densest pockets of the US, but the patterns outside of NYC may surprise you. For more, see

    ↩︎
  2. Specifically ACS-5 estimates are computed over a retrospective (looking backwards) five year window: e.g., the 2022 ACS-5 results are obtained by combining survey responses from 2018 to 2022.↩︎

  3. This the level of “ChatGPT-level” prose, without obvious flaws but lacking the style and elegance associated with true quality writing.↩︎

  4. Throughout this section, replace YOUR_GITHUB_ID with your GitHub ID from Mini-Project #00. Note that the automated course infrastructure will be looking for precise formatting, so follow these instructions closely.↩︎

  5. As of the time of writing this assignment, the latest ACS data are 2024, so interpret words like “current” or “present” to refer to 2024. If 2025 data become available when you are working on this project, please use those instead to perform more accurate analyses.↩︎

  6. If you are not getting values for ACS-1, it may be because the census suppresses small counts to maintain privacy. This is particularly likely when looking into demographic subgroups. If you are getting only missing values, switch to ACS-5 and the issue should resolve itself. If you are still exclusively getting missing values for ACS-5, please contact the instructor.↩︎

  7. If you don’t drop the geometry column first, you have to combine geometry elements during your summarize step. This is slow and unwieldy, so it’s far easier to drop, summarize, and then join back to the original data.↩︎

  8. Depending on what additional data you need and how exactly you structure your code, you might need to delete your cached data file to force a re-download with the additional variables. The question of knowing when to delete the cache is known as cache invalidation and it is a hard problem in computer science and system design.↩︎

  • Edit this page
  • View source
  • Report an issue