mirror of
https://github.com/lisawilliams/NIH_Data.git
synced 2025-08-02 20:24:19 -07:00
adding example charts
This commit is contained in:
parent
20d9c55c41
commit
47f2abf071
5 changed files with 28 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -45,8 +45,7 @@ Thumbs.db
|
||||||
.Rproj.user
|
.Rproj.user
|
||||||
.Rhistory
|
.Rhistory
|
||||||
|
|
||||||
#Image files#
|
|
||||||
*.png
|
|
||||||
|
|
||||||
# Files to ignore because they are huge files
|
# Files to ignore because they are huge files
|
||||||
|
|
||||||
|
|
27
NIH_Grants.R
27
NIH_Grants.R
|
@ -149,6 +149,33 @@ datatable(MYSTATE_ABBREVIATION_NIH_data_2023)
|
||||||
# you can always edit the .gitignore file if you want to change how
|
# you can always edit the .gitignore file if you want to change how
|
||||||
# things are handled.
|
# things are handled.
|
||||||
|
|
||||||
|
#do you want to see how your state compares to other states? Try this:
|
||||||
|
|
||||||
|
|
||||||
|
NIH_BY_STATE <- NIH_data_split_year %>%
|
||||||
|
filter(AWARD_NOTICE_DATE_YEAR == 2023) %>%
|
||||||
|
filter(ORG_COUNTRY == "UNITED STATES") %>%
|
||||||
|
filter(TOTAL_COST > 1000000) %>%
|
||||||
|
group_by(ORG_STATE) %>%
|
||||||
|
summarize(TOTAL_COST = sum(TOTAL_COST, na.rm=TRUE)) %>%
|
||||||
|
arrange(desc(TOTAL_COST))
|
||||||
|
|
||||||
|
write.csv(NIH_BY_STATE,"/Users/lisawilliams/code/R_For_Mass_Communications/NIH_Data/NIH_BY_STATE_2023.csv", row.names = FALSE)
|
||||||
|
|
||||||
|
|
||||||
|
plot_NIH_by_state <- ggplot(NIH_BY_STATE,
|
||||||
|
aes(x=reorder(NIH_BY_STATE$ORG_STATE,
|
||||||
|
NIH_BY_STATE$TOTAL_COST),
|
||||||
|
y=NIH_BY_STATE$TOTAL_COST)) +
|
||||||
|
geom_bar(stat="identity", fill="dodgerblue") +
|
||||||
|
scale_y_continuous(labels = scales::dollar_format(scale = .000001, suffix = "M"))+
|
||||||
|
#geom_text(aes(label = signif(TOTAL_COST)), nudge_y = 3) +
|
||||||
|
coord_flip() +
|
||||||
|
labs(x="", y="")+
|
||||||
|
ggtitle("NIH Funding By US State/Territory, 2023",
|
||||||
|
subtitle = "Data from NIH RePORTER")
|
||||||
|
|
||||||
|
plot_NIH_by_state + theme_light()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
example_plot_1.png
Normal file
BIN
example_plot_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
BIN
example_plot_2.png
Normal file
BIN
example_plot_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 148 KiB |
BIN
example_plot_3.png
Normal file
BIN
example_plot_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 123 KiB |
Loading…
Add table
Add a link
Reference in a new issue