The Neighborhood Package

An R package with various functions to study neighborhood dynamics.


devtools::install_github("timathomas/neighborhood", ref = "main")

Neighborhood Racial Typologies Function

The Neighborhood Racial Typologies function is a descriptive, categorical tool to help identify racial and ethnic divides within a region (e.g. city, county, state, etc.). Traditional segregation measures, such as the disimilarity index, provide a single measure for a large geographical area. This descripitve function is useful for mapping tract level, small area (e.g. neighborhood level) divisions between ethnic and racial groups.

The neighborhood typology is designated when a tract's racial/ethnic group share is more than 10%. For example, if a tract is 60% white, 30% Asian, 5% Black, and 5% Latinx then that tract will be called a majority Asian-White tract. This definition can be found in the NeighType field.

Because there are so many different combinations, I created the nt_conc field to show concatinated fields of 1, 2, or more groups.

Data download

All U.S. tract definitions can be downloaded in the data directory above.


This function is based off this paper: Hall, Matthew, Kyle Crowder, and Amy Spring. 2015. “Neighborhood Foreclosures, Racial/Ethnic Transitions, and Residential Segregation.” American Sociological Review 80:526–549.

  1. nt: Neighborhood Racial Typologies
  2. ntdf: create the dataframe for nt
  3. ntcheck: identify counts that can be concatenated


You can view an interactive map using this function here.

Baltimore_nt <- ntdf(state = "MD", county = "Baltimore City", geometry = TRUE)
cal <- ntdf(state = "CA")
ny <- ntdf(state = "NY")

ps_nt <- ntdf(state = "WA", county = c("Snohomish", "King", "Pierce"), geometry = TRUE)

# Check to see if there are duplicate tract assumptions. 
Baltimore_nt %>% 
st_set_geometry(NULL) %>% 
mutate(val = 1) %>%
spread(NeighType, val, fill = 0) %>% 
mutate_at(vars(`All Black`:`White-Shared`), list(as.numeric)) %>% 
select(13:ncol(.)) %>% 
mutate(rowsum = rowSums(.)) %>% 
filter(rowsum > 1) %>% 


After running the above code, look at the counts and consider concatenating and/or reducing outlying (small count) neighborhood types.


The nt_conc field concatenates the NeighType field automatically and may satisfy most people.

timathomas/neighborhood documentation built on May 16, 2022, 9:45 p.m.