Skip to content

Instantly share code, notes, and snippets.

@ngehlenborg
Last active March 16, 2017 12:51
Show Gist options
  • Save ngehlenborg/cc18a5dfffbe3e39884ee7270475397c to your computer and use it in GitHub Desktop.
Save ngehlenborg/cc18a5dfffbe3e39884ee7270475397c to your computer and use it in GitHub Desktop.
Possible impact of proposed NIH budget on states.
State Awards Funding Winner Population Non_Hispanic_White Hispanic_or_Latino Black American_Indian_or_Alaskan_Native Asian Native_Hawaiian_or_Pacific_Islander Mixed_race
Alabama 654 294964217 Trump 4822023 67 3.9 26.2 0.6 1.1 0.1 1.5
Alaska 17 14594777 Trump 731449 64.1 5.5 3.3 14.8 5.4 1 7.3
Arizona 382 163447535 Trump 6553255 57.8 29.6 4.1 4.6 2.8 0.2 3.4
Arkansas 108 96652655 Trump 2949131 74.5 6.4 15.4 0.8 1.2 0.2 2
California 7720 3686026589 Clinton 38041430 40.1 37.6 6.2 1 13 0.4 4.9
Colorado 991 349974172 Clinton 5187582 70 20.7 4 1.1 2.8 0.1 3.4
Connecticut 1179 510609681 Clinton 3590347 71.2 13.4 10.1 0.3 3.8 0 2.6
Delaware 75 45371848 Clinton 917092 65.3 8.2 21.4 0.5 3.2 0 2.7
District Of Columbia 361 214175791 Clinton 632323 34.8 9.1 50.7 0.3 3.5 0.1 2.9
Florida 1196 531720813 Trump 19317568 57.9 22.5 16 0.4 2.4 0.1 2.5
Georgia 1205 520595434 Trump 9919945 55.9 8.8 30.5 0.3 3.2 0.1 2.1
Hawaii 86 54427971 Clinton 1392313 22.7 8.9 1.6 0.3 38.6 10 23.6
Idaho 19 14139675 Trump 1595728 84 11.2 0.6 1.4 1.2 0.1 2.5
Illinois 1995 818027921 Clinton 12875255 63.7 15.8 14.5 0.3 4.6 0 2.3
Indiana 630 225125822 Trump 6537334 81.5 6 9.1 0.3 1.6 0 2
Iowa 415 170060863 Trump 3074186 88.7 5 2.9 0.4 1.7 0.1 1.8
Kansas 226 91306154 Trump 2885905 78.2 10.5 5.9 1 2.4 0.1 3
Kentucky 415 163613208 Trump 4380415 86.3 3.1 7.8 0.2 1.1 0.1 1.7
Louisiana 297 141817492 Trump 4601893 60.3 4.2 32 0.7 1.5 0 1.6
Maine 114 75619398 Clinton 1329192 94.4 1.3 1.2 0.6 1 0 1.6
Maryland 2358 1465624060 Clinton 5884563 54.7 8.2 29.4 0.4 5.5 0.1 2.9
Massachusetts 5029 2572549176 Clinton 6646144 76.1 9.6 6.6 0.3 5.3 0 2.6
Michigan 1530 669562129 Trump 9883360 76.6 4.4 14.2 0.6 2.4 0 2.3
Minnesota 1029 520225717 Clinton 5379139 83.1 4.7 5.2 1.1 4 0 2.4
Mississippi 89 53538828 Trump 2984926 58 2.7 37 0.5 0.9 0 1.1
Missouri 1158 508984218 Trump 6021988 81 3.5 11.6 0.5 1.6 0.1 2.1
Montana 85 37310308 Trump 1005141 87.8 2.9 0.4 6.3 0.6 0.1 2.5
Nebraska 241 107024633 Trump 1855525 82.1 9.2 4.5 1 1.8 0.1 2.2
Nevada 55 31316007 Clinton 2758931 54.1 26.5 8.1 1.2 7.2 0.6 4.7
New Hampshire 211 98857889 Clinton 1320718 92.3 2.8 1.1 0.2 2.2 0 1.6
New Jersey 571 240135510 Clinton 8864590 59.3 17.7 13.7 0.3 8.3 0 2.7
New Mexico 218 99743752 Clinton 2085538 40.5 46.3 2.1 9.4 1.4 0.1 3.7
New York 4953 2205949608 Clinton 19570261 58.3 17.6 15.9 0.6 7.3 0 3
North Carolina 2221 1154347750 Trump 9656401 65.3 8.4 21.5 1.3 2.2 0.1 2.2
North Dakota 36 22471682 Trump 699628 88.9 2 1.2 5.4 1 0 1.8
Ohio 1694 734159508 Trump 11544225 81.1 3.1 12.2 0.2 1.7 0 2.1
Oklahoma 182 90675755 Trump 3814820 68.7 8.9 7.4 8.6 1.7 0.1 5.9
Oregon 616 274614404 Clinton 3899353 78.5 11.7 1.8 1.4 3.7 0.3 3.8
Pennsylvania 3464 1570151520 Trump 12763536 79.5 5.7 10.8 0.2 2.7 0 1.9
Rhode Island 443 150833713 Clinton 1050292 76.4 12.4 5.7 0.6 2.9 0.1 3.3
South Carolina 432 179069761 Trump 4723723 64.1 5.1 27.9 0.4 1.3 0.1 1.7
South Dakota 35 21563049 Trump 833354 84.7 2.7 1.3 8.8 0.9 0 2.1
Tennessee 1187 512414823 Trump 6456243 75.6 4.6 16.7 0.3 1.4 0.1 1.7
Texas 2633 1097661190 Trump 26059203 45.3 37.6 11.8 0.7 3.8 0.1 2.7
Utah 455 185147981 Trump 2855287 80.4 13 1.1 1.2 2 0.9 2.7
Vermont 115 48758135 Clinton 626011 94.3 1.5 1 0.4 1.3 0 1.7
Virginia 816 349479689 Clinton 8185867 64.8 7.9 19.4 0.4 5.5 0.1 2.9
Washington 1555 952837210 Clinton 6897012 72.5 11.2 3.6 1.5 7.2 0.6 4.7
West Virginia 57 24040666 Trump 1855413 93.2 1.2 3.4 0.2 0.7 0 1.5
Wisconsin 902 421776499 Trump 5726386 83.3 5.9 6.3 1 2.3 0 1.8
Wyoming 15 9477709 Trump 576412 85.9 8.9 0.8 2.4 0.8 0.1 2.2
# Data Sources:
# NIH Extramural Funding (as of 03/13/2017): https://report.nih.gov/award/index.cfm?ot=&fy=2016&state=&ic=&fm=&orgid=&distr=&rfa=&om=n&pid=#tab1
# 2016 Presidential Election Results: https://en.wikipedia.org/wiki/United_States_presidential_election,_2016
# State Populations (2010 Census): https://en.wikipedia.org/wiki/Demography_of_the_United_States
# Budget Cut Information: https://www.washingtonpost.com/national/health-science/nih-would-see-huge-budget-cut-under-presidents-proposal/2017/03/15/8b6345cc-099e-11e7-93dc-00f9bdd74ed1_story.html
require(ggplot2)
grants <- read.table( "fy2016-nih-funding.csv", sep=",", header=T )
cut <- 0.19
plot <- ggplot( grants, aes(x=reorder(State, -Funding/Population*cut), y=Funding/Population*cut, fill=Winner)) + geom_bar(stat="identity")
plot <- plot + scale_fill_manual(values=c("#0072B2","#D55E00"))
plot <- plot + labs(y="NIH Extramural Award Dollars Lost Per Capita (based on 2016 budget)",
x="State")
plot <- plot + labs(title="Possible Impact of a 19% Budget Cut for the NIH: Everybody Loses But Not Equally So",
subtitle = "Based on NIH Reporter and Wikipedia data / Code + Data: https://gist.github.com/ngehlenborg/cc18a5dfffbe3e39884ee7270475397c",
caption="@nils_gehlenborg" )
plot <- plot + coord_fixed(2) + coord_flip()
ggsave("nih_funds_per-captia.png", plot, width=10.4, height=8)
plot <- ggplot( grants, aes(x=reorder(State, -Funding*cut), y=Funding*cut, fill=Winner)) + geom_bar(stat="identity")
plot <- plot + scale_fill_manual(values=c("#0072B2","#D55E00"))
plot <- plot + labs(y="Total NIH Extramural Award Dollars Lost (based on 2016 budget)",
x="State")
plot <- plot + labs(title="Possible Impact of a 19% Budget Cut for the NIH: Everybody Loses But Not Equally So",
subtitle = "Based on NIH Reporter and Wikipedia data / Code + Data: https://gist.github.com/ngehlenborg/cc18a5dfffbe3e39884ee7270475397c",
caption="@nils_gehlenborg" )
plot <- plot + scale_y_continuous(labels = scales::dollar, breaks=scales::pretty_breaks(n = 5))
plot <- plot + coord_fixed(2) + coord_flip()
ggsave("nih_funds_total.png", plot, width=10.4, height=8)
@ngehlenborg
Copy link
Author

ngehlenborg commented Mar 16, 2017

Visualization

NIH Extramural Award Dollars Lost Per Capita (based on 2016 budget)

nih_funds_per-captia

Total NIH Extramural Award Dollars Lost (based on 2016 budget)

nih_funds_total

Data Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment