An Analysis of Funding Patterns, Directorates, and Geographic Distribution
Author
Aisha Tarar, Chenxi Zhou, Yousra Elzamzami
Published
December 7, 2025
Introduction
The National Science Foundation (NSF) funds a wide range of scientific and educational projects across the United States, including programs designed to broaden participation in STEM fields. Within NSF’s portfolio, diversity, equity, and inclusion (DEI) refers to initiatives that support underrepresented groups, expand access to STEM education, or investigate structural barriers affecting participation in the scientific workforce. These awards appear across multiple directorates, especially those focused on education, human development, and STEM pathways.
In early 2025, the federal funding landscape shifted when a January 20 Executive Order directed agencies to review programs referencing DEI-related language. Following this directive, a large number of NSF award terminations were reported publicly, many involving grants with DEI components or awards to Minority-Serving Institutions. Although these events received extensive attention, it is not yet clear how the terminations compare to the broader NSF award portfolio or whether certain types of grants appeared more frequently than expected.
Understanding these patterns is important because NSF funding shapes institutional research capacity, supports the development of future scientists, and sustains programs focused on broadening STEM participation. If specific research areas or institution types are disproportionately represented in 2025 termination records, this has implications for equity, scientific independence, and the distribution of federal support across the research ecosystem.
Research Questions
This project analyzes NSF data from 2018–2025 to provide a descriptive, data-driven baseline of how termination patterns changed around the January 2025 Executive Order. Our analysis focuses on three guiding questions:
Temporal Impact - How did NSF’s termination patterns differ before versus after January 20, 2025?
DEI Disproportionality - Were DEI-focused grants or Minority-Serving Institutions represented in termination data at rates higher than their share in the overall NSF portfolio?
Directorate Patterns - Did directorates with larger DEI grant portfolios experience higher termination counts or proportions in 2025?
By comparing termination records to the distribution of NSF awards overall, we identify where 2025 patterns align with portfolio expectations and where they diverge. These results do not explain why terminations occurred, but they establish a clear foundation for interpreting how the policy environment of early 2025 appears in NSF’s publicly available data.
Data Sources
We’re using four main data sources for this analysis that each bring different strengths and limitations to our research. Together, these sources allow us to link grant-level information with institutional classifications to examine patterns in NSF terminations from 2018–2025.
This database serves as our primary source for terminated grant information. It tracks NSF grants that have been terminated and includes details like funding amounts, institution names, and project descriptions.
How the data was originally collected:
The Grant Witness database was developed with help from Noam Ross, who is a Computational Disease Ecologist and Executive Director at rOpenSci at UC Davis. Grant Witness appears to collect information through Freedom of Information Act requests, monitoring NSF announcements, and community members reporting terminations they become aware of.
Nature of the data:
This dataset is pre-processed rather than original NSF data. It combines FOIA responses, scraped NSF award pages, community submissions, and manually curated updates. The file we use is a cleaned, standardized version created by the Grant Witness team.
Potential missingness or bias:
Because the database relies heavily on voluntary reporting and FOIA releases, terminations that occur quietly or without public documentation may not be captured. This creates gaps that are not random—grants at larger institutions or involving politically sensitive topics may be more likely to be reported. Crowd-sourced updates also create variation in accuracy depending on who submits the information. Despite these limitations, it remains the most comprehensive public source for NSF termination data.
2. NCES Integrated Postsecondary Education Data System (IPEDS)
We use institutional characteristics from IPEDS to classify NSF award recipients. Variables include public–private control, HBCU and Tribal College designation, Carnegie research classification (R1–R3), institution level (2-year, 4-year), and enrollment size.
How the data was originally collected:
IPEDS is collected annually through mandatory federal reporting from all U.S. postsecondary institutions that participate in federal financial aid programs. Reporting is standardized across institutions, and coverage is nearly complete for accredited colleges and universities.
Nature of the data:
Our project uses a cleaned subset of IPEDS data that has been formatted specifically for merging with the Grant Witness dataset. Institutions that could not be matched (e.g., nonprofits, independent labs, federal research centers) are labeled as “Unknown.”
Potential missingness or bias:
Missingness typically occurs for NSF award recipients that are not traditional higher-education institutions and therefore do not report to IPEDS. This does not affect grant-level variables but does limit institutional-level analyses for those organizations.
3. Processed Dataset Used in This Analysis
After importing both the Grant Witness and IPEDS datasets, we merged them using institution names and applied several processing steps to prepare the data for analysis:
Standardized date formats
Extracted year variables
Added DEI keyword–based classifications
Assigned institutional characteristics
Labeled unknown or unmatched institutions
Created analysis-ready factors for NSF directorates and divisions
The final dataset used in this project is stored at: data_processed/nsf_data.csv
This dataset consists of roughly 90,000 NSF award records downloaded in JSON format from 2018 through 2025. Files were exported year by year, and each annual folder contains all NSF-funded awards issued in that calendar year.
How the data was originally collected:
Award records are generated and maintained internally by NSF as part of its grants administration system. Each funded project is assigned a formal award page containing metadata, program affiliation, budget information, and official project descriptions. NSF publishes these records through its online Award Search interface and API for public transparency.
Nature of the data:
These JSON files represent original, authoritative NSF administrative records, not community-compiled summaries. The consistent schema across years allowed us to extract and combine funding totals and organizational attributes to build a clean longitudinal baseline.
Potential missingness or bias:
Missingness is minimal and mainly affects very recent awards that may not yet be fully posted online. The dataset does not indicate termination status, so it is used only to measure normal NSF funding patterns and directorate structure - not to identify cancellations.
File location in this project: data_raw/previous_years/ - with annual subfolders (2018–2025) containing all JSON files for their respective year.
A full data dictionary describing all variables is provided in the Appendix.
Temporal Impact - How did NSF’s termination patterns differ before versus after January 20, 2025?
Funding and Termination Patterns (2018–2025)
Before examining the January 2025 Executive Order, we first establish how NSF funding usually behaves across its directorates. NSF’s budget distribution is uneven by design, so we need this baseline to judge whether the 2025 termination spike reflects normal patterns or a break from the norm.
The animated chart below shows total NSF funding by directorate from 2018–2024. The structure is highly stable:
Mathematical & Physical Sciences (MPS) and Engineering (ENG) consistently receive the largest budgets.
Geosciences (GEO) and Biological Sciences (BIO) form the middle tier.
Social, Behavioral & Economic Sciences (SBE) remains the smallest major directorate every year.
Technology, Innovation & Partnerships (TIP) is introduced in 2022 and grows steadily thereafter.
Across these years, budgets change gradually and show no unusual volatility. Because the NSF portfolio is so steady before 2025, the sudden concentration of terminations between April and July 2025 stands out as a disruption rather than a continuation of past trends.
Code
library(jsonlite)library(tidyverse)library(lubridate)library(here)# Path to JSON foldersjson_root <-here("data_raw", "previous_years")# List all JSON files for all yearsjson_files <-list.files(json_root, pattern ="\\.json$", recursive =TRUE, full.names =TRUE)#length(json_files) library(jsonlite)library(tidyverse)library(lubridate)library(here)# --- load the data ---load_award_json <-function(file) { j <-tryCatch(fromJSON(file), error =function(e) NULL)if (is.null(j)) return(NULL)tibble(award_id = j$awd_id,title = j$awd_titl_txt,abstract = j$awd_abstract_narration,# Correct date fields from JSONstart_date =ymd(j$awd_eff_date),end_date =ymd(j$awd_exp_date),# Directorate + divisiondirectorate = j$dir_abbr,division = j$div_abbr,# Fundingamount = j$awd_amount,# Year extracted from the start dateyear =year(ymd(j$awd_eff_date)) )}# --- load all years 2018–2025 ---load_award_year <-function(yr) { folder <-here("data_raw", "previous_years", as.character(yr)) files <-list.files(folder, pattern ="\\.json$", full.names =TRUE)map_df(files, load_award_json) %>%mutate(year = yr)}years <-2018:2025nsf_json <-map_df(years, load_award_year)nsf_json_clean <- nsf_json %>%filter(!is.na(start_date)) %>%mutate(eo_period =case_when( start_date <=as.Date("2025-01-20") ~"Pre-EO", start_date >as.Date("2025-01-20") ~"Post-EO" ) )
To understand whether 2025 stands out from earlier years, we next look at the timing of terminations across the entire 2018–2025 period. Because the Executive Order was issued on January 20, 2025, any meaningful effect would appear as changes in the months that follow. Monthly trends are especially useful here: terminations typically happen sporadically and at low volume, so any sudden or sustained shift becomes immediately visible. If the 2025 surge reflects a genuine break from past NSF behavior, we should see it clearly when plotting terminations on a month-by-month timeline.
Although the Executive Order was issued on January 20, 2025, the monthly pattern shows that terminations do not appear in the public record until April 2025, where the first measurable spike occurs. This does not necessarily mean NSF had zero terminations earlier in the year. The Grant Witness database began collecting and publishing termination information in April 2025, so the absence of observations in February–March most likely reflects the timing of public documentation rather than true inactivity.
Once reporting begins, the pattern is sharply concentrated:
April 2025 shows the first jump in terminations.
May 2025 reaches the peak, with more than 1,400 terminations recorded.
June 2025 drops to almost zero, likely due to processing delays or paused administrative action.
July 2025 rises again but remains well below May’s level.
This timeline indicates that the primary wave of terminations was clustered tightly within the months immediately following the Executive Order, even though reporting gaps limit what we can infer about activity before April. The shape of the curve, a rapid spike followed by collapse, suggests a concentrated administrative action rather than a gradual trend.
DEI Disproportionality – Are DEI Projects Overrepresented in Terminations?
The most significant finding from this dataset is the high prevalence of DEI-flagged grants within the termination pool.
Observation: Out of 1,986 total terminations, 1,357 grants (68.3%) were identified as “DEI Focused.”
Implication: This suggests that the 2025 termination cycle had a substantial impact on projects with explicit diversity, equity, and inclusion components. While this does not confirm causality (i.e., whether they were terminated because of this flag), the sheer volume indicates that the reduction in the portfolio heavily skewed toward these initiatives.
HBCU Representation
In contrast to the broader DEI category, Historically Black Colleges and Universities (HBCUs) represented a smaller fraction of the total terminations.
Observation: The analysis identified 67 terminations associated with HBCUs, accounting for 3.37% of the total dataset.
Context: Earlier data validation efforts suggested a known population of approximately 69 relevant HBCU institutions in the broader scope; finding 67 terminations suggests that nearly the entire identified cohort in this specific query set faced termination, or that the count is highly accurate to the specific “Yes” flag logic implemented. While 3.37% is a small slice of the total 1,986, it is critical to weigh this against the total number of funded HBCUs to determine proportionality.
Sector Distribution
The terminations were predominantly concentrated in the public sector.
Observation: Public institutions accounted for 1,281 terminations (approx. 64.5%).
Implication: State-funded and public entities bore the majority of the fiscal or administrative adjustments leading to these terminations.
This treemap visualization and summary statistics reveal a distinct pattern in the 2025 termination data. While the specific institutional impact on HBCUs appears low in absolute volume (67 grants), the broader impact on equity-focused research is profound, with over two-thirds (68.3%) of all terminated grants carrying a DEI flag. This discrepancy suggests that while specific institutional types like HBCUs were not the primary driver of the volume, the content or focus of the research (DEI) was a major commonality among the terminated projects. Future analysis should investigate whether this 68.3% represents a disproportionate share compared to the NSF’s total active portfolio.
Geographic Concentration of DEI Terminations (2025)
To complement the institutional analysis provided by the Treemap, the Geographic Heatmap investigates the spatial dimension of the 2025 terminations. This visualization distinguishes between the volume of terminations and the intensity (rate) of DEI-specific cancellations, revealing a complex landscape that does not strictly adhere to expected political or regional lines.
Volume vs. Intensity: The California Paradox
California appears as the primary “hot spot” in terms of absolute volume, indicated by the map’s Gold Circle epicenter. With 213 DEI terminations (out of 477 total), it bears the highest numerical burden. However, a deeper analysis of the rate reveals a paradox: California’s DEI termination rate is only 44.7%. This indicates that while the state lost the most DEI grants, the majority of its terminations actually fell into non-DEI categories, suggesting a broader, sector-wide contraction in that region rather than a targeted strike solely on equity initiatives.
High-Intensity Hubs: Massachusetts and Texas
In contrast to California, other major research hubs displayed a much higher concentration of DEI-specific terminations.
Massachusetts: Ranking second in volume with 185 DEI terminations, the state showed a significantly higher intensity, with 72% of its total cancellations (257) being DEI-focused.
Texas: Ranking third in volume with 95 DEI terminations, Texas exhibited an even higher intensity, with 77.9% of its 122 total terminations targeting DEI initiatives.
Total Saturation: The 100% Impact States
Perhaps the most striking finding from the interactive tooltip data is the existence of states where 100% of the terminated grants were DEI-focused. In Arkansas (AR), New Hampshire (NH), Maine (ME), and West Virginia (WV), every single grant terminated in the 2025 cycle was flagged for DEI. While the total volume in these states is lower than the major hubs, the rate suggests that in these specific research environments, non-DEI grants were effectively insulated from the termination wave, while equity-focused projects faced total elimination.
Crucially, the geographic distribution challenges the assumption that DEI terminations would be clustered solely along political party lines. The high termination rates in traditionally Democratic strongholds (e.g., Massachusetts at 72%) are exceeded by rates in traditionally Republican strongholds (e.g., Texas at 77.9% and Arkansas at 100%). This geographic ubiquity suggests that the driver of these terminations is likely a centralized federal or agency-level policy shift regarding DEI criteria, rather than a reflection of local state-level political pressures.
Directorate Patterns - Are Terminations Concentrated in Areas with Larger DEI Portfolios?
The research question guiding this section examines whether NSF directorates with stronger ties to DEI-focused programming suffered a larger share of the 2025 termination wave. Because the NSF portfolio is structured around distinct directorates with some focused on core scientific research (e.g., Mathematical & Physical Sciences, Engineering) and others on education and social dimensions of science (e.g., STEM Education, Social/Behavioral/Economic Sciences), we can explore whether terminations match expected patterns or show disproportionate targeting.
DEI Termination Rates Across Directorates
The first visualization compares each directorate’s actual DEI termination rate against the portfolio-wide baseline of 68.3%. If terminations were proportionally distributed across the NSF portfolio, we would expect all directorates to cluster near this baseline. Significant deviations suggest that certain areas were either targeted more intensely or largely spared.
The dumbbell chart reveals a clear split in how terminations affected different parts of the NSF portfolio:
Directorates Exceeding the Expected DEI Rate:
STEM Education leads with an 81.1% DEI termination rate which is 13 percentage points above the baseline. With 659 out of 813 terminated grants flagged as DEI-focused, this directorate accounts for nearly half of all DEI terminations in the dataset.
Biological Sciences (71.4%) and Social/Behavioral/Economic Sciences (70.2%) also exceeded the expected rate, though by smaller margins. These directorates focus on research areas where broadening participation and equity studies are more common.
Office of the Director shows 77.8% DEI terminations, though the small sample size (9 grants) limits interpretation.
Directorates Below the Expected DEI Rate:
Mathematical & Physical Sciences (47.3%) and Geosciences (49.3%) had DEI rates roughly 20 percentage points below the baseline. These directorates focus on fundamental research areas less commonly associated with equity-focused programming.
Computer & Information Science (56.7%) and Engineering (64.1%) fell between these extremes but still below the portfolio average.
This pattern suggests that the 2025 termination wave did not randomly affect the NSF portfolio. Instead, directorates with historically larger shares of DEI-oriented programming, particularly STEM Education, absorbed a disproportionate impact relative to their research counterparts.
STEM Research vs Education & Social Sciences
To further contextualize these directorate patterns, we group NSF’s nine directorates into two broad categories: STEM Research (Biological Sciences, Computer & Information Science, Engineering, Geosciences, Mathematical & Physical Sciences, and Technology/Innovation/Partnerships) and Education & Social Sciences (STEM Education, Social/Behavioral/Economic Sciences, and Office of the Director). This classification distinguishes between directorates focused primarily on scientific discovery and those oriented toward educational access, workforce development, or social dimensions of science.
The stacked bar chart reveals a pronounced structural divide in how the 2025 terminations affected different segments of NSF:
Volume Concentration in Education & Social Sciences: The three directorates in this category account for 1,137 of the 1,986 total terminations (57.3%), with STEM Education alone contributing 813 terminated grants. Despite representing a smaller portion of NSF’s overall research portfolio, these directorates faced the majority of the termination wave.
DEI Intensity Gap: Within Education & Social Sciences, 78.0% of terminated grants were DEI-focused. In contrast, STEM Research directorates showed a DEI termination rate of 56.4% which is still substantial but 22 percentage points lower.
Within STEM Research Variation: Even among core research directorates, notable differences show. Biological Sciences (71.4% DEI) exceeds the overall baseline, likely reflecting that directorate’s emphasis on broadening participation in life sciences. On the other end, Mathematical & Physical Sciences (47.3%) and Geosciences (49.3%) show the lowest DEI intensities, suggesting their terminations were less tied to DEI content.
These patterns indicate that the January 2025 Executive Order’s effects were not uniform across NSF. Directorates whose missions intersect most directly with educational access and social equity—rather than fundamental scientific research experienced both higher absolute termination counts and higher proportions of DEI-flagged terminations.
Conclusions
From 2018–2024, NSF funding across directorates was stable and changed only gradually. Because the portfolio normally behaves this way, the sudden concentration of cancellations in April–July 2025 stands out as a disruption rather than normal administrative variation. Although funding and termination records are independent data systems, the 2025 termination spike mirrors a moment when the overall grant environment contracted, suggesting that NSF’s portfolio reduction and the concentration of cancellations are part of the same administrative response rather than routine fluctuation.
Within the terminated pool, the most visible pattern is content-based: roughly two-thirds of cancelled grants had DEI components. This does not prove that DEI caused the cancellations, but it shows that equity-related projects were highly concentrated in the 2025 termination wave rather than evenly spread across the portfolio. Geographic patterns reinforce this point, with multiple states showing near-total DEI saturation among cancelled awards.
Limitations and Future Work
Termination reporting before April 2025 is incomplete, so we cannot measure early 2025 activity with confidence. Standard NSF JSON records do not include termination status, which prevents us from directly linking funding amounts to cancellation outcomes.
Future work should rely on more complete internal agency records or expanded termination reporting to fill gaps. Additional variables such as grant topic, review score, or award duration would make it possible to see whether the 2025 termination wave was temporary, selective, or part of a broader restructuring.
Attribution
This project was completed collaboratively by Aisha Tarar, Chenxi Zhou, and Yousra Elzamzami. All team members worked together on the introduction, research questions, data sources, and conclusions sections.
For the analysis, Yousra focused on Research Question 1 (Temporal Impact), Chenxi handled Research Question 2 (DEI Disproportionality), and Aisha completed Research Question 3 (Directorate Patterns). Each team member contributed to reviewing and refining the overall report.
Appendix
Data Dictionary
Code
# Create the data dictionary as a data framedata_dict <-data.frame(Variable =c(# Grant-level variables"grant_id", "status", "terminated", "suspended", "termination_date","termination_indicator", "reinstated", "reinstatement_date", "nsf_url", "usaspending_url", "project_title", "abstract","org_name", "org_state", "org_city", "award_type","nsf_start_date", "nsf_end_date", "nsf_program_name","nsf_total_budget", "nsf_obligated", "usaspending_obligated","usaspending_outlaid", "division", "directorate",# Institutional characteristics"public_private", "hbcu_flag", "tribal_flag", "institution_level","research_level", "size_category", "type_of_organization",# Derived variables"start_year", "dei_flag" ),Type =c(# Grant-level variables"Text", "Text", "Boolean", "Boolean", "Date", "Text", "Boolean", "Date","URL", "URL", "Text", "Text", "Text", "Text", "Text", "Categorical","Date", "Date", "Text", "Numeric", "Numeric", "Numeric", "Numeric","Text", "Text",# Institutional characteristics"Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical",# Derived variables"Numeric", "Boolean" ),Description =c(# Grant-level variables"Unique 7-digit identifier for each NSF grant","Current status indicator with termination symbols","Binary indicator of grant termination (TRUE/FALSE)","Binary indicator of grant suspension (TRUE/FALSE)","Date when grant was terminated (MM/DD/YY format)","Source and method of termination identification","Binary indicator of grant reinstatement (TRUE/FALSE)","Date when grant was reinstated if applicable","Direct link to NSF award page","Direct link to USAspending.gov record","Official title of the funded research project","Full project description (200-500+ words)","Name of recipient institution","State location of recipient institution","City location of recipient institution","NSF award mechanism (Standard Grant, Continuing Grant, etc.)","Grant start date from NSF records","Grant end date or termination date from NSF records","NSF program managing the grant","Total funding amount allocated by NSF in USD","Amount obligated by NSF in USD","Amount obligated according to USAspending.gov in USD","Amount outlaid according to USAspending.gov in USD","NSF organizational division managing the grant","NSF directorate overseeing the division",# Institutional characteristics"Institution control type (Public, Private nonprofit, Private for-profit)","HBCU designation status (Yes, No, Unknown)","Tribal college designation status (Yes, No, Unknown)","Institution level (2-year Community College, 4-year University)","Carnegie research classification (R1, R2, R3)","Institution size based on enrollment (Small, Medium, Large)","Organization type (Academia, Government, Industry, Other)",# Derived variables"Year extracted from nsf_start_date","Binary indicator for DEI-related content based on keyword matching" ),Source =c(rep("Grant Witness", 25),rep("IPEDS Enhancement", 7),rep("Calculated", 2) ),Category =c(rep("Grant-Level Variables", 25),rep("Institutional Characteristics", 7),rep("Derived Variables", 2) ),stringsAsFactors =FALSE)# Create HTML table with custom stylinghtml_table <-paste0("<div style='overflow-x:auto;'>","<table style='width:100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>","<caption style='font-weight: bold; font-size: 16px; margin-bottom: 10px; text-align: left;'>","Table A1. Description of Variables Used in NSF Grant Termination Analysis","</caption>","<thead>","<tr style='background-color: #f2f2f2;'>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Category</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Variable Name</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Data Type</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Description</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Data Source</th>","</tr>","</thead>","<tbody>")# Add table rows with alternating colors for better readabilityfor (i in1:nrow(data_dict)) { bg_color <-ifelse(i %%2==0, "#f9f9f9", "#ffffff")# Add section headers show_category <- (i ==1|| data_dict$Category[i] != data_dict$Category[i-1])if (show_category) { html_table <-paste0(html_table,"<tr style='background-color: ", bg_color, ";'>","<td style='border: 1px solid #ddd; padding: 8px; font-weight: bold; vertical-align: top;' rowspan='",sum(data_dict$Category == data_dict$Category[i]),"'>", data_dict$Category[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'><code>", data_dict$Variable[i], "</code></td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Type[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Description[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Source[i], "</td>","</tr>" ) } else { html_table <-paste0(html_table,"<tr style='background-color: ", bg_color, ";'>","<td style='border: 1px solid #ddd; padding: 8px;'><code>", data_dict$Variable[i], "</code></td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Type[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Description[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Source[i], "</td>","</tr>" ) }}html_table <-paste0(html_table, "</tbody></table></div>")# Display the HTML tablehtmltools::HTML(html_table)
Table A1. Description of Variables Used in NSF Grant Termination Analysis
Category
Variable Name
Data Type
Description
Data Source
Grant-Level Variables
grant_id
Text
Unique 7-digit identifier for each NSF grant
Grant Witness
status
Text
Current status indicator with termination symbols
Grant Witness
terminated
Boolean
Binary indicator of grant termination (TRUE/FALSE)
Grant Witness
suspended
Boolean
Binary indicator of grant suspension (TRUE/FALSE)
Grant Witness
termination_date
Date
Date when grant was terminated (MM/DD/YY format)
Grant Witness
termination_indicator
Text
Source and method of termination identification
Grant Witness
reinstated
Boolean
Binary indicator of grant reinstatement (TRUE/FALSE)
Grant Witness
reinstatement_date
Date
Date when grant was reinstated if applicable
Grant Witness
nsf_url
URL
Direct link to NSF award page
Grant Witness
usaspending_url
URL
Direct link to USAspending.gov record
Grant Witness
project_title
Text
Official title of the funded research project
Grant Witness
abstract
Text
Full project description (200-500+ words)
Grant Witness
org_name
Text
Name of recipient institution
Grant Witness
org_state
Text
State location of recipient institution
Grant Witness
org_city
Text
City location of recipient institution
Grant Witness
award_type
Categorical
NSF award mechanism (Standard Grant, Continuing Grant, etc.)
Grant Witness
nsf_start_date
Date
Grant start date from NSF records
Grant Witness
nsf_end_date
Date
Grant end date or termination date from NSF records
Grant Witness
nsf_program_name
Text
NSF program managing the grant
Grant Witness
nsf_total_budget
Numeric
Total funding amount allocated by NSF in USD
Grant Witness
nsf_obligated
Numeric
Amount obligated by NSF in USD
Grant Witness
usaspending_obligated
Numeric
Amount obligated according to USAspending.gov in USD
Grant Witness
usaspending_outlaid
Numeric
Amount outlaid according to USAspending.gov in USD
Grant Witness
division
Text
NSF organizational division managing the grant
Grant Witness
directorate
Text
NSF directorate overseeing the division
Grant Witness
Institutional Characteristics
public_private
Categorical
Institution control type (Public, Private nonprofit, Private for-profit)
IPEDS Enhancement
hbcu_flag
Categorical
HBCU designation status (Yes, No, Unknown)
IPEDS Enhancement
tribal_flag
Categorical
Tribal college designation status (Yes, No, Unknown)
IPEDS Enhancement
institution_level
Categorical
Institution level (2-year Community College, 4-year University)
IPEDS Enhancement
research_level
Categorical
Carnegie research classification (R1, R2, R3)
IPEDS Enhancement
size_category
Categorical
Institution size based on enrollment (Small, Medium, Large)
IPEDS Enhancement
type_of_organization
Categorical
Organization type (Academia, Government, Industry, Other)
IPEDS Enhancement
Derived Variables
start_year
Numeric
Year extracted from nsf_start_date
Calculated
dei_flag
Boolean
Binary indicator for DEI-related content based on keyword matching
Table A2. Variables Used From NSF Award Search JSON Records
Category
Variable Name
Data Type
Description
Data Source
Award-Level Variables
awd_id
Text
Unique NSF award identifier
NSF Award Search JSON
awd_titl_txt
Text
Official award title assigned by NSF
NSF Award Search JSON
awd_abstract_narration
Text
Full project abstract and narrative
NSF Award Search JSON
awd_eff_date
Date
Award effective/start date
NSF Award Search JSON
awd_exp_date
Date
Award expiration/end date
NSF Award Search JSON
dir_abbr
Categorical
NSF directorate abbreviation
NSF Award Search JSON
div_abbr
Categorical
NSF division abbreviation
NSF Award Search JSON
awd_amount
Numeric
Total obligated award amount in USD
NSF Award Search JSON
Derived Variables
year
Numeric
Year extracted from awd_eff_date
Calculated
eo_period
Categorical
Binary classification of awards as Pre-EO or Post-EO based on January 20, 2025
Calculated
Source Code
---title: "Following the Funding: DEI Trends in NSF Grants, 2018–2025"subtitle: "An Analysis of Funding Patterns, Directorates, and Geographic Distribution"author: Aisha Tarar, Chenxi Zhou, Yousra Elzamzamidate: December 07, 2025format: html: toc: true toc-location: right theme: flatly self-contained: true code-fold: true code-tools: trueexecute: freeze: auto---```{r}#| label: setup #| include: false# Load libraries and settings herelibrary(tidyverse)library(here)knitr::opts_chunk$set(warning =FALSE,message =FALSE,comment ="#>",fig.path ="figs/", # Folder where rendered plots are savedfig.width =7.252, # Default plot widthfig.height =4, # Default plot heightfig.retina =3# For better plot resolution)# Put any other "global" settings here, e.g. a ggplot theme:theme_set(theme_bw(base_size =20))# Write code below here to load any data used in project```{width=100%}# Introduction The National Science Foundation (NSF) funds a wide range of scientific and educational projects across the United States, including programs designed to broaden participation in STEM fields. Within NSF’s portfolio, diversity, equity, and inclusion (DEI) refers to initiatives that support underrepresented groups, expand access to STEM education, or investigate structural barriers affecting participation in the scientific workforce. These awards appear across multiple directorates, especially those focused on education, human development, and STEM pathways. In early 2025, the federal funding landscape shifted when a January 20 Executive Order directed agencies to review programs referencing DEI-related language. Following this directive, a large number of NSF award terminations were reported publicly, many involving grants with DEI components or awards to Minority-Serving Institutions. Although these events received extensive attention, it is not yet clear how the terminations compare to the broader NSF award portfolio or whether certain types of grants appeared more frequently than expected. Understanding these patterns is important because NSF funding shapes institutional research capacity, supports the development of future scientists, and sustains programs focused on broadening STEM participation. If specific research areas or institution types are disproportionately represented in 2025 termination records, this has implications for equity, scientific independence, and the distribution of federal support across the research ecosystem.# Research Questions This project analyzes NSF data from 2018–2025 to provide a descriptive, data-driven baseline of how termination patterns changed around the January 2025 Executive Order. Our analysis focuses on three guiding questions:1. **Temporal Impact** - How did NSF’s termination patterns differ before versus after January 20, 2025?2. **DEI Disproportionality** - Were DEI-focused grants or Minority-Serving Institutions represented in termination data at rates higher than their share in the overall NSF portfolio?3. **Directorate Patterns** - Did directorates with larger DEI grant portfolios experience higher termination counts or proportions in 2025?By comparing termination records to the distribution of NSF awards overall, we identify where 2025 patterns align with portfolio expectations and where they diverge. These results do not explain why terminations occurred, but they establish a clear foundation for interpreting how the policy environment of early 2025 appears in NSF’s publicly available data. # Data Sources We're using four main data sources for this analysis that each bring different strengths and limitations to our research. Together, these sources allow us to link grant-level information with institutional classifications to examine patterns in NSF terminations from 2018–2025. ### 1. Grant Witness NSF Termination Dataset**Source:** Grant Witness **URL:** <https://grant-witness.us/nsf-data.html>This database serves as our primary source for terminated grant information. It tracks NSF grants that have been terminated and includes details like funding amounts, institution names, and project descriptions.**How the data was originally collected:** The Grant Witness database was developed with help from Noam Ross, who is a Computational Disease Ecologist and Executive Director at rOpenSci at UC Davis. Grant Witness appears to collect information through Freedom of Information Act requests, monitoring NSF announcements, and community members reporting terminations they become aware of.**Nature of the data:** This dataset is pre-processed rather than original NSF data. It combines FOIA responses, scraped NSF award pages, community submissions, and manually curated updates. The file we use is a cleaned, standardized version created by the Grant Witness team.**Potential missingness or bias:** Because the database relies heavily on voluntary reporting and FOIA releases, terminations that occur quietly or without public documentation may not be captured. This creates gaps that are not random—grants at larger institutions or involving politically sensitive topics may be more likely to be reported. Crowd-sourced updates also create variation in accuracy depending on who submits the information. Despite these limitations, it remains the most comprehensive public source for NSF termination data.### 2. NCES Integrated Postsecondary Education Data System (IPEDS)**Source:** U.S. Department of Education **URL:** <https://nces.ed.gov/ipeds/use-the-data>We use institutional characteristics from IPEDS to classify NSF award recipients. Variables include public–private control, HBCU and Tribal College designation, Carnegie research classification (R1–R3), institution level (2-year, 4-year), and enrollment size.**How the data was originally collected:** IPEDS is collected annually through mandatory federal reporting from all U.S. postsecondary institutions that participate in federal financial aid programs. Reporting is standardized across institutions, and coverage is nearly complete for accredited colleges and universities.**Nature of the data:** Our project uses a cleaned subset of IPEDS data that has been formatted specifically for merging with the Grant Witness dataset. Institutions that could not be matched (e.g., nonprofits, independent labs, federal research centers) are labeled as “Unknown.”**Potential missingness or bias:** Missingness typically occurs for NSF award recipients that are not traditional higher-education institutions and therefore do not report to IPEDS. This does not affect grant-level variables but does limit institutional-level analyses for those organizations.### 3. Processed Dataset Used in This AnalysisAfter importing both the Grant Witness and IPEDS datasets, we merged them using institution names and applied several processing steps to prepare the data for analysis:- Standardized date formats - Extracted year variables - Added DEI keyword–based classifications - Assigned institutional characteristics - Labeled unknown or unmatched institutions - Created analysis-ready factors for NSF directorates and divisions The final dataset used in this project is stored at: **data_processed/nsf_data.csv**### 4. NSF Award Search JSON Records (2018–2025)**Source:** National Science Foundation Award Search Database**URL:** <https://www.nsf.gov/awardsearch/simple-search/>This dataset consists of roughly 90,000 NSF award records downloaded in JSON format from 2018 through 2025. Files were exported year by year, and each annual folder contains all NSF-funded awards issued in that calendar year.**How the data was originally collected:** Award records are generated and maintained internally by NSF as part of its grants administration system. Each funded project is assigned a formal award page containing metadata, program affiliation, budget information, and official project descriptions. NSF publishes these records through its online Award Search interface and API for public transparency.**Nature of the data:** These JSON files represent original, authoritative NSF administrative records, not community-compiled summaries. The consistent schema across years allowed us to extract and combine funding totals and organizational attributes to build a clean longitudinal baseline.**Potential missingness or bias:** Missingness is minimal and mainly affects very recent awards that may not yet be fully posted online. The dataset does not indicate termination status, so it is used only to measure normal NSF funding patterns and directorate structure - not to identify cancellations.**File location in this project:** data_raw/previous_years/ - with annual subfolders (2018–2025) containing all JSON files for their respective year.A full **data dictionary** describing all variables is provided in the **[Appendix](#appendix-data-dictionary)**.# **Temporal Impact** - How did NSF’s termination patterns differ before versus after January 20, 2025? ## Funding and Termination Patterns (2018–2025)Before examining the January 2025 Executive Order, we first establish how NSF funding usually behaves across its directorates. NSF’s budget distribution is uneven by design, so we need this baseline to judge whether the 2025 termination spike reflects normal patterns or a break from the norm.The animated chart below shows total NSF funding by directorate from 2018–2024. The structure is highly stable:- **Mathematical & Physical Sciences (MPS)** and **Engineering (ENG)** consistently receive the largest budgets. - **Geosciences (GEO)** and **Biological Sciences (BIO)** form the middle tier. - **Social, Behavioral & Economic Sciences (SBE)** remains the smallest major directorate every year. - **Technology, Innovation & Partnerships (TIP)** is introduced in 2022 and grows steadily thereafter.Across these years, budgets change gradually and show no unusual volatility. Because the NSF portfolio is so steady before 2025, the sudden concentration of terminations between April and July 2025 stands out as a disruption rather than a continuation of past trends.```{r}#| label: load-nsf-json#| cache: true#| warning: false#| message: falselibrary(jsonlite)library(tidyverse)library(lubridate)library(here)# Path to JSON foldersjson_root <-here("data_raw", "previous_years")# List all JSON files for all yearsjson_files <-list.files(json_root, pattern ="\\.json$", recursive =TRUE, full.names =TRUE)#length(json_files) library(jsonlite)library(tidyverse)library(lubridate)library(here)# --- load the data ---load_award_json <-function(file) { j <-tryCatch(fromJSON(file), error =function(e) NULL)if (is.null(j)) return(NULL)tibble(award_id = j$awd_id,title = j$awd_titl_txt,abstract = j$awd_abstract_narration,# Correct date fields from JSONstart_date =ymd(j$awd_eff_date),end_date =ymd(j$awd_exp_date),# Directorate + divisiondirectorate = j$dir_abbr,division = j$div_abbr,# Fundingamount = j$awd_amount,# Year extracted from the start dateyear =year(ymd(j$awd_eff_date)) )}# --- load all years 2018–2025 ---load_award_year <-function(yr) { folder <-here("data_raw", "previous_years", as.character(yr)) files <-list.files(folder, pattern ="\\.json$", full.names =TRUE)map_df(files, load_award_json) %>%mutate(year = yr)}years <-2018:2025nsf_json <-map_df(years, load_award_year)nsf_json_clean <- nsf_json %>%filter(!is.na(start_date)) %>%mutate(eo_period =case_when( start_date <=as.Date("2025-01-20") ~"Pre-EO", start_date >as.Date("2025-01-20") ~"Post-EO" ) )``````{r}library(plotly)library(dplyr)valid_dirs <-c("BIO","CSE","CISE","EDU","EHR","ENG","GEO","MPS","SBE","TIP")dir_map <-c("BIO"="Biological Sciences","CSE"="Computer & Information Science & Engineering","CISE"="Computer & Information Science & Engineering","EDU"="STEM Education","EHR"="STEM Education","ENG"="Engineering","GEO"="Geosciences","MPS"="Mathematical & Physical Sciences","SBE"="Social, Behavioral & Economic Sciences","TIP"="Technology, Innovation & Partnerships")race_df <- nsf_json_clean %>%filter(directorate %in% valid_dirs) %>%mutate(directorate_full = dir_map[directorate]) %>%group_by(year, directorate_full) %>%summarise(total_funding =sum(amount, na.rm =TRUE), .groups ="drop") %>%group_by(year) %>%arrange(desc(total_funding)) %>%mutate(order_y =factor(directorate_full, levels = directorate_full),is_top = total_funding ==max(total_funding),bar_color =ifelse(is_top, "#9C783D", "#002F6E") )p <-plot_ly( race_df,x =~total_funding,y =~order_y,frame =~year,type ="bar",orientation ="h",color =~I(bar_color)) %>%layout(title ="NSF Funding by Directorate (Animated Race Chart, 2018–2025)",xaxis =list(title ="Funding (USD)",tickvals =c(0, 5e8, 1e9, 1.5e9, 2e9, 2.5e9),ticktext =c("$0", "$500M", "$1B", "$1.5B", "$2B", "$2.5B") ),yaxis =list(title =""),margin =list(l =250),showlegend =FALSE ) %>%animation_opts(frame =2000,transition =800,easing ="linear",redraw =FALSE ) %>%animation_slider(currentvalue =list(prefix ="Year: "),bgcolor ="white" )p```## Monthly Termination Trends (2018–2025)To understand whether 2025 stands out from earlier years, we next look at the timing of terminations across the entire 2018–2025 period. Because the Executive Order was issued on January 20, 2025, any meaningful effect would appear as changes in the months that follow. Monthly trends are especially useful here: terminations typically happen sporadically and at low volume, so any sudden or sustained shift becomes immediately visible. If the 2025 surge reflects a genuine break from past NSF behavior, we should see it clearly when plotting terminations on a month-by-month timeline.```{r}#just in caselibrary(tidyverse)library(lubridate)nsf <-read_csv("data_processed/nsf_data.csv")nsf_monthly <- nsf %>%filter(!is.na(termination_date)) %>%mutate(term_date =mdy(termination_date),term_year =year(term_date),term_month =floor_date(term_date, unit ="month") ) %>%group_by(term_month) %>%summarise(terminations =n(), .groups ="drop")eo_date <-as.Date("2025-01-20")p_monthly <-plot_ly( nsf_monthly,x =~term_month,y =~terminations,type ='scatter',mode ='lines+markers',inherit =FALSE,marker =list(size =8, color ="#9C783D"),line =list(color ="#002F6E", width =3),hovertemplate =paste0("<b>%{x|%b %Y}</b><br>","Terminations: %{y}<extra></extra>" )) %>%# Executive Order vertical lineadd_lines(x =c(eo_date, eo_date),y =c(0, max(nsf_monthly$terminations)),line =list(color ="#CC0000", dash ="dash", width =2),hoverinfo ="none",showlegend =FALSE ) %>%# Annotate EO dateadd_annotations(x = eo_date,y =max(nsf_monthly$terminations) *0.15,text ="Executive Order<br>Jan 20, 2025",xanchor ="left",yanchor ="bottom",font =list(color ="#CC0000", size =12),showarrow =FALSE ) %>%layout(title =list(text ="Monthly NSF Terminations (2018–2025)",x =0.1, y =0.95 ),xaxis =list(title ="Month",tickformat ="%b<br>%Y",tickangle =0 ),yaxis =list(title ="Number of Terminations" ),hovermode ="x unified" )p_monthly```Although the Executive Order was issued on January 20, 2025, the monthly pattern shows that **terminations do not appear in the public record until April 2025**, where the first measurable spike occurs. This does *not* necessarily mean NSF had zero terminations earlier in the year. The Grant Witness database began collecting and publishing termination information **in April 2025**, so the absence of observations in February–March most likely reflects the timing of public documentation rather than true inactivity.Once reporting begins, the pattern is sharply concentrated:- **April 2025** shows the first jump in terminations. - **May 2025** reaches the peak, with more than 1,400 terminations recorded. - **June 2025** drops to almost zero, likely due to processing delays or paused administrative action. - **July 2025** rises again but remains well below May’s level.This timeline indicates that the **primary wave of terminations was clustered tightly within the months immediately following the Executive Order**, even though reporting gaps limit what we can infer about activity before April. The shape of the curve, a rapid spike followed by collapse, suggests a concentrated administrative action rather than a gradual trend.# **DEI Disproportionality** – Are DEI Projects Overrepresented in Terminations? ## Treemap of Institutional Patterns ```{r}library(tidyverse)library(lubridate)library(plotly)library(scales) library(here)file_path <-here("data_processed", "nsf_data.csv")nsf_data <-read_csv(file_path, show_col_types =FALSE)nsf_terminated_2025 <- nsf_data %>%mutate(term_date_parsed =mdy(termination_date),term_year =year(term_date_parsed) ) %>%filter(term_year ==2025)plot_data <- nsf_terminated_2025 %>%mutate(public_private =ifelse(is.na(public_private), "Unknown Sector", public_private),research_level =ifelse(is.na(research_level), "Unknown R-Level", research_level),hbcu_label =case_when( hbcu_flag =="Yes"| hbcu_flag =="yes"~"HBCU",TRUE~"Non-HBCU" ),dei_label =case_when( DEI_flag ==TRUE| DEI_flag =="TRUE"| DEI_flag ==1~"DEI Focused",TRUE~"Non-DEI" ),count =1 )stats_summary <- plot_data %>%summarise(Total_Terminated =n(),DEI_Count =sum(dei_label =="DEI Focused"),DEI_Percent = (DEI_Count / Total_Terminated) *100,HBCU_Count =sum(hbcu_label =="HBCU"),HBCU_Percent = (HBCU_Count / Total_Terminated) *100,Public_Count =sum(public_private =="Public"),Public_Percent = (Public_Count / Total_Terminated) *100 )print("--- Summary Statistics for 2025 Terminations ---")print(stats_summary)nsf_dark_blue <-"#002F6E"nsf_light_blue <-"#1083D3"nsf_gold <-"#9C783D"nsf_white <-"#FFFFFF"tm_root <- plot_data %>%summarise(value =n()) %>%mutate(labels ="All Terminations", parents ="", id ="All Terminations", color = nsf_dark_blue)tm_l1 <- plot_data %>%group_by(public_private) %>%summarise(value =n()) %>%mutate(labels = public_private,parents ="All Terminations",id = public_private,color = nsf_light_blue )tm_l2 <- plot_data %>%group_by(public_private, research_level) %>%summarise(value =n(), .groups ="drop") %>%mutate(labels = research_level,parents = public_private,id =paste(public_private, research_level, sep =" - "),color = nsf_light_blue )tm_l3 <- plot_data %>%group_by(public_private, research_level, hbcu_label) %>%summarise(value =n(), .groups ="drop") %>%mutate(labels = hbcu_label,parents =paste(public_private, research_level, sep =" - "),id =paste(public_private, research_level, hbcu_label, sep =" - "),color =ifelse(hbcu_label =="HBCU", nsf_gold, nsf_light_blue) )tm_l4 <- plot_data %>%group_by(public_private, research_level, hbcu_label, dei_label) %>%summarise(value =n(), .groups ="drop") %>%mutate(labels = dei_label,parents =paste(public_private, research_level, hbcu_label, sep =" - "),id =paste(public_private, research_level, hbcu_label, dei_label, sep =" - "),color =ifelse(dei_label =="DEI Focused", nsf_gold, "#E0E0E0") )treemap_df <-bind_rows(tm_root, tm_l1, tm_l2, tm_l3, tm_l4)fig_treemap <-plot_ly(data = treemap_df,type ="treemap",ids =~id,labels =~labels,parents =~parents,values =~value,marker =list(colors =~color),textinfo ="label+value+percent parent",branchvalues ="total",pathbar =list(visible =TRUE)) %>%layout(title ="Hierarchy of 2025 Terminated Grants: Institution -> Research Level -> HBCU -> DEI")fig_treemap```### Results1. The Preponderance of DEI-Focused TerminationsThe most significant finding from this dataset is the high prevalence of DEI-flagged grants within the termination pool.a. Observation: Out of 1,986 total terminations, **1,357 grants (68.3%)** were identified as "DEI Focused."b. Implication: This suggests that the 2025 termination cycle had a substantial impact on projects with explicit diversity, equity, and inclusion components. While this does not confirm causality (i.e., whether they were terminated because of this flag), the sheer volume indicates that the reduction in the portfolio heavily skewed toward these initiatives.2. HBCU RepresentationIn contrast to the broader DEI category, Historically Black Colleges and Universities (HBCUs) represented a smaller fraction of the total terminations.a. Observation: The analysis identified **67 terminations** associated with HBCUs, accounting for **3.37%** of the total dataset.b. Context: Earlier data validation efforts suggested a known population of approximately 69 relevant HBCU institutions in the broader scope; finding 67 terminations suggests that nearly the entire identified cohort in this specific query set faced termination, or that the count is highly accurate to the specific "Yes" flag logic implemented. While 3.37% is a small slice of the total 1,986, it is critical to weigh this against the total number of funded HBCUs to determine proportionality.3. Sector DistributionThe terminations were predominantly concentrated in the public sector.a. Observation: Public institutions accounted for **1,281 terminations (approx. 64.5%)**.b. Implication: State-funded and public entities bore the majority of the fiscal or administrative adjustments leading to these terminations.This treemap visualization and summary statistics reveal a distinct pattern in the 2025 termination data. While the specific institutional impact on HBCUs appears low in absolute volume (67 grants), the broader impact on equity-focused research is profound, with over two-thirds (68.3%) of all terminated grants carrying a DEI flag. This discrepancy suggests that while specific institutional types like HBCUs were not the primary driver of the volume, the content or focus of the research (DEI) was a major commonality among the terminated projects. Future analysis should investigate whether this 68.3% represents a disproportionate share compared to the NSF's total active portfolio.## Geographic Concentration of DEI Terminations (2025)```{r}library(tidyverse)library(lubridate)library(plotly)library(here)file_path <-here("data_processed", "nsf_data.csv")nsf_data <-read_csv(file_path, show_col_types =FALSE)nsf_terminated_2025 <- nsf_data %>%mutate(term_date_parsed =mdy(termination_date),term_year =year(term_date_parsed) ) %>%filter(term_year ==2025)state_summary <- nsf_terminated_2025 %>%group_by(org_state) %>%summarise(Total_Grants =n(),DEI_Count =sum(DEI_flag ==TRUE| DEI_flag =="TRUE"| DEI_flag ==1, na.rm =TRUE),DEI_Percent =round((DEI_Count / Total_Grants) *100, 1) ) %>%filter(!is.na(org_state)) data("state")state_coords <-data.frame(org_state = state.abb,lat = state.center$y,lon = state.center$x)map_data <- state_summary %>%left_join(state_coords, by ="org_state")top_dei_state <- map_data %>%filter(DEI_Count ==max(DEI_Count))state_annotations <-list()for (i in1:nrow(map_data)) {# Skip states with missing coordinates (e.g., DC/PR if not in base dataset)if (!is.na(map_data$lat[i]) &!is.na(map_data$lon[i])) { state_annotations[[i]] <-list(x = map_data$lon[i],y = map_data$lat[i],text = map_data$org_state[i],showarrow =FALSE,font =list(color ="black", size =10),xanchor ='center',yanchor ='middle' ) }}nsf_dark_blue <-"#002F6E"nsf_light_blue <-"#1083D3"nsf_gold <-"#9C783D"nsf_white <-"#FFFFFF"nsf_pale_blue <-"#D6E4F0"fig_map <-plot_geo(map_data, locationmode ='USA-states') %>%add_trace(z =~DEI_Count,locations =~org_state,type ='choropleth',colors =c(nsf_pale_blue, nsf_dark_blue),text =~paste("State:", org_state, "<br>","DEI Grants:", DEI_Count, "<br>","Total Grants:", Total_Grants, "<br>","DEI Focus (%):", DEI_Percent, "%" ),hoverinfo ="text",marker =list(line =list(color ='rgb(255,255,255)', width =1.5) ),colorbar =list(title ="DEI Grant Count") ) %>%add_markers(data = top_dei_state,x =~lon,y =~lat,mode ="markers",marker =list(size =25, color ="rgba(0,0,0,0)",line =list(color = nsf_gold, width =4 ),symbol ="circle" ),showlegend =FALSE,hoverinfo ="text",text =~paste("<b>HIGHEST DEI COUNT</b><br>", org_state, ": ", DEI_Count, " Grants") ) %>%layout(title =list(text ='<b>2025 Terminated Grants: DEI Focus by State</b><br><sup>Gold Circle indicates state with highest DEI count</sup>'),geo =list(scope ='usa',projection =list(type ='albers usa'),showlakes =TRUE,lakecolor ='rgb(255, 255, 255)',showland =TRUE, landcolor ='#F0F0F0', countrycolor ='rgb(255, 255, 255)',subunitcolor ='rgb(255, 255, 255)' ),annotations = state_annotations # Add the text labels here )fig_map```### ResultsTo complement the institutional analysis provided by the Treemap, the Geographic Heatmap investigates the spatial dimension of the 2025 terminations. This visualization distinguishes between the *volume* of terminations and the *intensity* (rate) of DEI-specific cancellations, revealing a complex landscape that does not strictly adhere to expected political or regional lines.1. Volume vs. Intensity: The California ParadoxCalifornia appears as the primary "hot spot" in terms of absolute volume, indicated by the map's **Gold Circle** epicenter. With **213 DEI terminations** (out of 477 total), it bears the highest numerical burden. However, a deeper analysis of the rate reveals a paradox: California's DEI termination rate is only **44.7%**. This indicates that while the state lost the most DEI grants, the majority of its terminations actually fell into non-DEI categories, suggesting a broader, sector-wide contraction in that region rather than a targeted strike solely on equity initiatives.2. High-Intensity Hubs: Massachusetts and TexasIn contrast to California, other major research hubs displayed a much higher concentration of DEI-specific terminations.a. **Massachusetts**: Ranking second in volume with 185 DEI terminations, the state showed a significantly higher intensity, with **72%** of its total cancellations (257) being DEI-focused.b. **Texas**: Ranking third in volume with 95 DEI terminations, Texas exhibited an even higher intensity, with **77.9%** of its 122 total terminations targeting DEI initiatives.3. Total Saturation: The 100% Impact StatesPerhaps the most striking finding from the interactive tooltip data is the existence of states where **100%** of the terminated grants were DEI-focused. In Arkansas (AR), New Hampshire (NH), Maine (ME), and West Virginia (WV), every single grant terminated in the 2025 cycle was flagged for DEI. While the total volume in these states is lower than the major hubs, the rate suggests that in these specific research environments, non-DEI grants were effectively insulated from the termination wave, while equity-focused projects faced total elimination.Crucially, the geographic distribution challenges the assumption that DEI terminations would be clustered solely along political party lines. The high termination rates in traditionally Democratic strongholds (e.g., Massachusetts at 72%) are exceeded by rates in traditionally Republican strongholds (e.g., Texas at 77.9% and Arkansas at 100%). This geographic ubiquity suggests that the driver of these terminations is likely a centralized federal or agency-level policy shift regarding DEI criteria, rather than a reflection of local state-level political pressures.# **Directorate Patterns** - Are Terminations Concentrated in Areas with Larger DEI Portfolios?The research question guiding this section examines whether NSF directorates with stronger ties to DEI-focused programming suffered a larger share of the 2025 termination wave. Because the NSF portfolio is structured around distinct directorates with some focused on core scientific research (e.g., Mathematical & Physical Sciences, Engineering) and others on education and social dimensions of science (e.g., STEM Education, Social/Behavioral/Economic Sciences), we can explore whether terminations match expected patterns or show disproportionate targeting.## DEI Termination Rates Across DirectoratesThe first visualization compares each directorate's actual DEI termination rate against the portfolio-wide baseline of 68.3%. If terminations were proportionally distributed across the NSF portfolio, we would expect all directorates to cluster near this baseline. Significant deviations suggest that certain areas were either targeted more intensely or largely spared.```{r}#| label: rq3-dumbbell-chart#| warning: false#| message: falselibrary(tidyverse)library(lubridate)library(plotly)library(scales)nsf_dark_blue <-"#002F6E"nsf_light_blue <-"#1083D3"nsf_gold <-"#9C783D"file_path <-here("data_processed", "nsf_data.csv")nsf_data <-read_csv(file_path, show_col_types =FALSE)nsf_2025 <- nsf_data %>%mutate(term_date_parsed =mdy(termination_date),term_year =year(term_date_parsed) ) %>%filter(term_year ==2025)directorate_dei <- nsf_2025 %>%group_by(directorate) %>%summarise(total =n(),dei_count =sum(DEI_flag ==TRUE| DEI_flag =="TRUE", na.rm =TRUE),dei_rate = (dei_count / total) *100,.groups ="drop" ) %>%filter(!is.na(directorate)) %>%mutate(dir_short =case_when( directorate =="STEM Education"~"STEM Education", directorate =="Social, Behavioral and Economic Sciences"~"Social/Behavioral/Econ", directorate =="Mathematical and Physical Sciences"~"Math & Physical Sciences", directorate =="Computer and Information Science and Engineering"~"Computer & Info Science", directorate =="Engineering"~"Engineering", directorate =="Geosciences"~"Geosciences", directorate =="Biological Sciences"~"Biological Sciences", directorate =="Technology, Innovation and Partnerships"~"Tech/Innovation/Partners", directorate =="Office of the Director"~"Office of Director",TRUE~ directorate ) )overall_dei_rate <-sum(nsf_2025$DEI_flag ==TRUE| nsf_2025$DEI_flag =="TRUE", na.rm =TRUE) /nrow(nsf_2025) *100dumbbell_data <- directorate_dei %>%arrange(dei_rate) %>%mutate(expected_rate = overall_dei_rate,above_expected = dei_rate > expected_rate,dir_short =factor(dir_short, levels = dir_short) )fig_dumbbell <-plot_ly(height =500) %>%add_segments(data = dumbbell_data,x =~expected_rate, xend =~dei_rate,y =~dir_short, yend =~dir_short,line =list(color ="#D0D0D0", width =3),showlegend =FALSE,hoverinfo ="none" ) %>%add_markers(data = dumbbell_data,x =~expected_rate,y =~dir_short,marker =list(color = nsf_light_blue, size =16, line =list(color ="white", width =2)),name ="Expected Rate (68.3%)",hovertemplate =paste0("<b>%{y}</b><br>","Expected Rate: 68.3%<extra></extra>" ) ) %>%add_markers(data = dumbbell_data,x =~dei_rate,y =~dir_short,marker =list(color =~ifelse(above_expected, nsf_gold, nsf_dark_blue),size =16,line =list(color ="white", width =2) ),name ="Actual DEI Rate",text =~paste0(round(dei_rate, 1), "%"),hovertemplate =paste0("<b>%{y}</b><br>","Actual DEI Rate: %{x:.1f}%<br>","Total Terminated: ", dumbbell_data$total, " grants<extra></extra>" ) ) %>%add_segments(x = overall_dei_rate, xend = overall_dei_rate,y =-0.5, yend =nrow(dumbbell_data) -0.5,line =list(color = nsf_light_blue, dash ="dot", width =2),showlegend =FALSE,hoverinfo ="none" ) %>%layout(title =list(text ="<b>DEI Termination Rates by Directorate vs Expected Baseline</b><br><sup style='color:#666'>Gold dots = Above expected rate (68.3%) | Dark blue dots = Below expected rate</sup>",x =0.02,xanchor ="left",font =list(size =16) ),xaxis =list(title =list(text ="DEI Termination Rate (%)", font =list(size =13)),range =c(40, 90),ticksuffix ="%",tickfont =list(size =11),gridcolor ="#E8E8E8" ),yaxis =list(title ="",categoryorder ="array",categoryarray = dumbbell_data$dir_short,type ="category",tickmode ="array",tickvals = dumbbell_data$dir_short,ticktext = dumbbell_data$dir_short ),legend =list(orientation ="h",x =0.5,xanchor ="center",y =-0.25,font =list(size =11) ),margin =list(l =180, r =60, t =80, b =100),plot_bgcolor ="#FAFAFA",paper_bgcolor ="#FFFFFF",annotations =list(list(x =85,y =9,text ="<b>Expected Rate<br>(68.3%)</b>",showarrow =TRUE,arrowhead =0,ax =0,ay =0,font =list(color = nsf_light_blue, size =11),xanchor ="left" ) ) )fig_dumbbell```### Results: Directorate-Level DEI PatternsThe dumbbell chart reveals a clear split in how terminations affected different parts of the NSF portfolio:**Directorates Exceeding the Expected DEI Rate:**- **STEM Education** leads with an 81.1% DEI termination rate which is 13 percentage points above the baseline. With 659 out of 813 terminated grants flagged as DEI-focused, this directorate accounts for nearly half of all DEI terminations in the dataset.- **Biological Sciences** (71.4%) and **Social/Behavioral/Economic Sciences** (70.2%) also exceeded the expected rate, though by smaller margins. These directorates focus on research areas where broadening participation and equity studies are more common.- **Office of the Director** shows 77.8% DEI terminations, though the small sample size (9 grants) limits interpretation.**Directorates Below the Expected DEI Rate:**- **Mathematical & Physical Sciences** (47.3%) and **Geosciences** (49.3%) had DEI rates roughly 20 percentage points below the baseline. These directorates focus on fundamental research areas less commonly associated with equity-focused programming.- **Computer & Information Science** (56.7%) and **Engineering** (64.1%) fell between these extremes but still below the portfolio average.This pattern suggests that the 2025 termination wave did not randomly affect the NSF portfolio. Instead, directorates with historically larger shares of DEI-oriented programming, particularly STEM Education, absorbed a disproportionate impact relative to their research counterparts.## STEM Research vs Education & Social SciencesTo further contextualize these directorate patterns, we group NSF's nine directorates into two broad categories: **STEM Research** (Biological Sciences, Computer & Information Science, Engineering, Geosciences, Mathematical & Physical Sciences, and Technology/Innovation/Partnerships) and **Education & Social Sciences** (STEM Education, Social/Behavioral/Economic Sciences, and Office of the Director). This classification distinguishes between directorates focused primarily on scientific discovery and those oriented toward educational access, workforce development, or social dimensions of science.```{r}#| label: rq3-interactive-stacked#| warning: false#| message: falsedirectorate_stem <- nsf_2025 %>%mutate(stem_category =case_when( directorate %in%c("Biological Sciences", "Computer and Information Science and Engineering","Engineering", "Geosciences", "Mathematical and Physical Sciences","Technology, Innovation and Partnerships") ~"STEM Research", directorate %in%c("STEM Education", "Social, Behavioral and Economic Sciences","Office of the Director") ~"Education & Social Sciences",TRUE~"Other" ),dei_label =ifelse(DEI_flag ==TRUE| DEI_flag =="TRUE", "DEI-Focused", "Non-DEI"),dir_short =case_when( directorate =="STEM Education"~"STEM Education", directorate =="Social, Behavioral and Economic Sciences"~"Social/Behavioral/Econ", directorate =="Mathematical and Physical Sciences"~"Math & Physical Sciences", directorate =="Computer and Information Science and Engineering"~"Computer & Info Science", directorate =="Engineering"~"Engineering", directorate =="Geosciences"~"Geosciences", directorate =="Biological Sciences"~"Biological Sciences", directorate =="Technology, Innovation and Partnerships"~"Tech/Innovation/Partners", directorate =="Office of the Director"~"Office of Director",TRUE~ directorate ) ) %>%filter(!is.na(directorate))stem_summary <- directorate_stem %>%group_by(stem_category, dir_short, dei_label) %>%summarise(count =n(), .groups ="drop") %>%group_by(dir_short) %>%mutate(total =sum(count)) %>%ungroup()# Separate data for each viewall_dei <- stem_summary %>%filter(dei_label =="DEI-Focused") %>%arrange(desc(total))all_nondei <- stem_summary %>%filter(dei_label =="Non-DEI") %>%arrange(desc(total))stem_only_dei <- stem_summary %>%filter(stem_category =="STEM Research", dei_label =="DEI-Focused") %>%arrange(desc(total))stem_only_nondei <- stem_summary %>%filter(stem_category =="STEM Research", dei_label =="Non-DEI") %>%arrange(desc(total))edu_only_dei <- stem_summary %>%filter(stem_category =="Education & Social Sciences", dei_label =="DEI-Focused") %>%arrange(desc(total))edu_only_nondei <- stem_summary %>%filter(stem_category =="Education & Social Sciences", dei_label =="Non-DEI") %>%arrange(desc(total))all_order <- all_dei %>%arrange(total) %>%pull(dir_short)stem_order <- stem_only_dei %>%arrange(total) %>%pull(dir_short)edu_order <- edu_only_dei %>%arrange(total) %>%pull(dir_short)fig_interactive <-plot_ly(height =450) %>%add_bars(data = all_dei,x =~count,y =~factor(dir_short, levels = all_order),name ="DEI-Focused",marker =list(color = nsf_gold),orientation ='h',visible =TRUE,hovertemplate ="<b>%{y}</b><br>DEI-Focused: %{x} grants<extra></extra>" ) %>%add_bars(data = all_nondei,x =~count,y =~factor(dir_short, levels = all_order),name ="Non-DEI",marker =list(color = nsf_dark_blue),orientation ='h',visible =TRUE,hovertemplate ="<b>%{y}</b><br>Non-DEI: %{x} grants<extra></extra>" ) %>%# VIEW 2: STEM Research Onlyadd_bars(data = stem_only_dei,x =~count,y =~factor(dir_short, levels = stem_order),name ="DEI-Focused",marker =list(color = nsf_gold),orientation ='h',visible =FALSE,hovertemplate ="<b>%{y}</b><br>DEI-Focused: %{x} grants<extra></extra>" ) %>%add_bars(data = stem_only_nondei,x =~count,y =~factor(dir_short, levels = stem_order),name ="Non-DEI",marker =list(color = nsf_dark_blue),orientation ='h',visible =FALSE,hovertemplate ="<b>%{y}</b><br>Non-DEI: %{x} grants<extra></extra>" ) %>%# VIEW 3: Education Onlyadd_bars(data = edu_only_dei,x =~count,y =~factor(dir_short, levels = edu_order),name ="DEI-Focused",marker =list(color = nsf_gold),orientation ='h',visible =FALSE,hovertemplate ="<b>%{y}</b><br>DEI-Focused: %{x} grants<extra></extra>" ) %>%add_bars(data = edu_only_nondei,x =~count,y =~factor(dir_short, levels = edu_order),name ="Non-DEI",marker =list(color = nsf_dark_blue),orientation ='h',visible =FALSE,hovertemplate ="<b>%{y}</b><br>Non-DEI: %{x} grants<extra></extra>" ) %>%layout(title =list(text ="<b>2025 Grant Terminations by Directorate and DEI Status</b>",font =list(size =16),x =0.5,xanchor ="center",y =0.98 ),xaxis =list(title =list(text ="Number of Terminated Grants", font =list(size =12)),gridcolor ="#E0E0E0",tickfont =list(size =11),range =c(0, 900) ),yaxis =list(title =list(text ="Directorate", font =list(size =12)),tickfont =list(size =11),categoryorder ="array",categoryarray = all_order ),barmode ='stack',legend =list(orientation ="h",x =0.5,xanchor ="center",y =-0.15,font =list(size =11) ),margin =list(l =160, r =30, t =100, b =70),plot_bgcolor ="#FAFAFA",paper_bgcolor ="#FFFFFF",updatemenus =list(list(type ="buttons",direction ="right",x =0,y =1.15,xanchor ="left",yanchor ="top",bgcolor ="#FFFFFF",bordercolor ="#AAAAAA",font =list(size =11),pad =list(r =8, t =3, b =3, l =8),buttons =list(list(method ="update",args =list(list(visible =c(TRUE, TRUE, FALSE, FALSE, FALSE, FALSE)),list(yaxis =list(categoryorder ="array", categoryarray = all_order, title =list(text ="Directorate", font =list(size =12)), tickfont =list(size =11)) ) ),label ="All" ),list(method ="update",args =list(list(visible =c(FALSE, FALSE, TRUE, TRUE, FALSE, FALSE)),list(yaxis =list(categoryorder ="array", categoryarray = stem_order, title =list(text ="Directorate", font =list(size =12)), tickfont =list(size =11)) ) ),label ="STEM Research" ),list(method ="update",args =list(list(visible =c(FALSE, FALSE, FALSE, FALSE, TRUE, TRUE)),list(yaxis =list(categoryorder ="array", categoryarray = edu_order, title =list(text ="Directorate", font =list(size =12)), tickfont =list(size =11)) ) ),label ="Education & Social" ) ) ) ) )fig_interactive```### Results: The STEM Research vs Education DivideThe stacked bar chart reveals a pronounced structural divide in how the 2025 terminations affected different segments of NSF:1. **Volume Concentration in Education & Social Sciences**: The three directorates in this category account for **1,137** of the 1,986 total terminations (57.3%), with STEM Education alone contributing 813 terminated grants. Despite representing a smaller portion of NSF's overall research portfolio, these directorates faced the majority of the termination wave.2. **DEI Intensity Gap**: Within Education & Social Sciences, **78.0%** of terminated grants were DEI-focused. In contrast, STEM Research directorates showed a DEI termination rate of **56.4%** which is still substantial but 22 percentage points lower.3. **Within STEM Research Variation**: Even among core research directorates, notable differences show. Biological Sciences (71.4% DEI) exceeds the overall baseline, likely reflecting that directorate's emphasis on broadening participation in life sciences. On the other end, Mathematical & Physical Sciences (47.3%) and Geosciences (49.3%) show the lowest DEI intensities, suggesting their terminations were less tied to DEI content.These patterns indicate that the January 2025 Executive Order's effects were not uniform across NSF. Directorates whose missions intersect most directly with educational access and social equity—rather than fundamental scientific research experienced both higher absolute termination counts and higher proportions of DEI-flagged terminations.# **Conclusions**From 2018–2024, NSF funding across directorates was stable and changed only gradually. Because the portfolio normally behaves this way, the sudden concentration of cancellations in April–July 2025 stands out as a disruption rather than normal administrative variation. Although funding and termination records are independent data systems, the 2025 termination spike mirrors a moment when the overall grant environment contracted, suggesting that NSF’s portfolio reduction and the concentration of cancellations are part of the same administrative response rather than routine fluctuation.Within the terminated pool, the most visible pattern is content-based: roughly two-thirds of cancelled grants had DEI components. This does not prove that DEI caused the cancellations, but it shows that equity-related projects were highly concentrated in the 2025 termination wave rather than evenly spread across the portfolio. Geographic patterns reinforce this point, with multiple states showing near-total DEI saturation among cancelled awards.## Limitations and Future WorkTermination reporting before April 2025 is incomplete, so we cannot measure early 2025 activity with confidence. Standard NSF JSON records do not include termination status, which prevents us from directly linking funding amounts to cancellation outcomes.Future work should rely on more complete internal agency records or expanded termination reporting to fill gaps. Additional variables such as grant topic, review score, or award duration would make it possible to see whether the 2025 termination wave was temporary, selective, or part of a broader restructuring.# AttributionThis project was completed collaboratively by Aisha Tarar, Chenxi Zhou, and Yousra Elzamzami. All team members worked together on the introduction, research questions, data sources, and conclusions sections. For the analysis, Yousra focused on Research Question 1 (Temporal Impact), Chenxi handled Research Question 2 (DEI Disproportionality), and Aisha completed Research Question 3 (Directorate Patterns). Each team member contributed to reviewing and refining the overall report.# Appendix## Data Dictionary {#appendix-data-dictionary}```{r}# Create the data dictionary as a data framedata_dict <-data.frame(Variable =c(# Grant-level variables"grant_id", "status", "terminated", "suspended", "termination_date","termination_indicator", "reinstated", "reinstatement_date", "nsf_url", "usaspending_url", "project_title", "abstract","org_name", "org_state", "org_city", "award_type","nsf_start_date", "nsf_end_date", "nsf_program_name","nsf_total_budget", "nsf_obligated", "usaspending_obligated","usaspending_outlaid", "division", "directorate",# Institutional characteristics"public_private", "hbcu_flag", "tribal_flag", "institution_level","research_level", "size_category", "type_of_organization",# Derived variables"start_year", "dei_flag" ),Type =c(# Grant-level variables"Text", "Text", "Boolean", "Boolean", "Date", "Text", "Boolean", "Date","URL", "URL", "Text", "Text", "Text", "Text", "Text", "Categorical","Date", "Date", "Text", "Numeric", "Numeric", "Numeric", "Numeric","Text", "Text",# Institutional characteristics"Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical",# Derived variables"Numeric", "Boolean" ),Description =c(# Grant-level variables"Unique 7-digit identifier for each NSF grant","Current status indicator with termination symbols","Binary indicator of grant termination (TRUE/FALSE)","Binary indicator of grant suspension (TRUE/FALSE)","Date when grant was terminated (MM/DD/YY format)","Source and method of termination identification","Binary indicator of grant reinstatement (TRUE/FALSE)","Date when grant was reinstated if applicable","Direct link to NSF award page","Direct link to USAspending.gov record","Official title of the funded research project","Full project description (200-500+ words)","Name of recipient institution","State location of recipient institution","City location of recipient institution","NSF award mechanism (Standard Grant, Continuing Grant, etc.)","Grant start date from NSF records","Grant end date or termination date from NSF records","NSF program managing the grant","Total funding amount allocated by NSF in USD","Amount obligated by NSF in USD","Amount obligated according to USAspending.gov in USD","Amount outlaid according to USAspending.gov in USD","NSF organizational division managing the grant","NSF directorate overseeing the division",# Institutional characteristics"Institution control type (Public, Private nonprofit, Private for-profit)","HBCU designation status (Yes, No, Unknown)","Tribal college designation status (Yes, No, Unknown)","Institution level (2-year Community College, 4-year University)","Carnegie research classification (R1, R2, R3)","Institution size based on enrollment (Small, Medium, Large)","Organization type (Academia, Government, Industry, Other)",# Derived variables"Year extracted from nsf_start_date","Binary indicator for DEI-related content based on keyword matching" ),Source =c(rep("Grant Witness", 25),rep("IPEDS Enhancement", 7),rep("Calculated", 2) ),Category =c(rep("Grant-Level Variables", 25),rep("Institutional Characteristics", 7),rep("Derived Variables", 2) ),stringsAsFactors =FALSE)# Create HTML table with custom stylinghtml_table <-paste0("<div style='overflow-x:auto;'>","<table style='width:100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>","<caption style='font-weight: bold; font-size: 16px; margin-bottom: 10px; text-align: left;'>","Table A1. Description of Variables Used in NSF Grant Termination Analysis","</caption>","<thead>","<tr style='background-color: #f2f2f2;'>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Category</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Variable Name</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Data Type</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Description</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Data Source</th>","</tr>","</thead>","<tbody>")# Add table rows with alternating colors for better readabilityfor (i in1:nrow(data_dict)) { bg_color <-ifelse(i %%2==0, "#f9f9f9", "#ffffff")# Add section headers show_category <- (i ==1|| data_dict$Category[i] != data_dict$Category[i-1])if (show_category) { html_table <-paste0(html_table,"<tr style='background-color: ", bg_color, ";'>","<td style='border: 1px solid #ddd; padding: 8px; font-weight: bold; vertical-align: top;' rowspan='",sum(data_dict$Category == data_dict$Category[i]),"'>", data_dict$Category[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'><code>", data_dict$Variable[i], "</code></td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Type[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Description[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Source[i], "</td>","</tr>" ) } else { html_table <-paste0(html_table,"<tr style='background-color: ", bg_color, ";'>","<td style='border: 1px solid #ddd; padding: 8px;'><code>", data_dict$Variable[i], "</code></td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Type[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Description[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", data_dict$Source[i], "</td>","</tr>" ) }}html_table <-paste0(html_table, "</tbody></table></div>")# Display the HTML tablehtmltools::HTML(html_table)``````{r}json_dict <-data.frame(Variable =c("awd_id","awd_titl_txt","awd_abstract_narration","awd_eff_date","awd_exp_date","dir_abbr","div_abbr","awd_amount","year","eo_period"),Type =c("Text","Text","Text","Date","Date","Categorical","Categorical","Numeric","Numeric","Categorical"),Description =c("Unique NSF award identifier","Official award title assigned by NSF","Full project abstract and narrative","Award effective/start date","Award expiration/end date","NSF directorate abbreviation","NSF division abbreviation","Total obligated award amount in USD","Year extracted from awd_eff_date","Binary classification of awards as Pre-EO or Post-EO based on January 20, 2025"),Source =c(rep("NSF Award Search JSON", 8),rep("Calculated", 2)),Category =c(rep("Award-Level Variables", 8),rep("Derived Variables", 2)),stringsAsFactors =FALSE)html_json <-paste0("<div style='overflow-x:auto;'>","<table style='width:100%; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px;'>","<caption style='font-weight: bold; font-size: 16px; margin-bottom: 10px; text-align: left;'>","Table A2. Variables Used From NSF Award Search JSON Records","</caption>","<thead>","<tr style='background-color: #f2f2f2;'>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Category</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Variable Name</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Data Type</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Description</th>","<th style='border: 1px solid #ddd; padding: 12px; text-align: left; font-weight: bold;'>Data Source</th>","</tr>","</thead>","<tbody>")# build rowsfor (i in1:nrow(json_dict)) {bg <-ifelse(i %%2==0, "#f9f9f9", "#ffffff")show_cat <- (i ==1|| json_dict$Category[i] != json_dict$Category[i-1])if (show_cat) {html_json <-paste0(html_json,"<tr style='background-color: ", bg, ";'>","<td style='border: 1px solid #ddd; padding: 8px; font-weight: bold; vertical-align: top;' rowspan='",sum(json_dict$Category == json_dict$Category[i]),"'>", json_dict$Category[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'><code>", json_dict$Variable[i], "</code></td>","<td style='border: 1px solid #ddd; padding: 8px;'>", json_dict$Type[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", json_dict$Description[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", json_dict$Source[i], "</td>","</tr>")} else {html_json <-paste0(html_json,"<tr style='background-color: ", bg, ";'>","<td style='border: 1px solid #ddd; padding: 8px;'><code>", json_dict$Variable[i], "</code></td>","<td style='border: 1px solid #ddd; padding: 8px;'>", json_dict$Type[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", json_dict$Description[i], "</td>","<td style='border: 1px solid #ddd; padding: 8px;'>", json_dict$Source[i], "</td>","</tr>")}}html_json <-paste0(html_json, "</tbody></table></div>")htmltools::HTML(html_json)```