Last active
December 7, 2018 14:41
-
-
Save lmullen/9606187 to your computer and use it in GitHub Desktop.
Charting Faculty Salaries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(reshape2) | |
library(stringr) | |
library(ggplot2) | |
library(RColorBrewer) | |
# options(stringsAsFactors = FALSE) | |
options("scipen"=100, "digits"=4) | |
salaries <- read.csv("faculty-salaries-2013-14.csv") | |
salaries <- salaries %.% | |
melt(id = c("rank", "discipline"), | |
variable.name = "institution_type", value.name = "salary") | |
avg_salaries <- salaries %.% | |
filter(discipline == "All disciplines combined") | |
salaries$discipline <- salaries$discipline %.% str_sub(1,32) | |
full_salary <- salaries %.% | |
filter(rank == "Professor") %.% | |
filter(institution_type == "All_institutions") %.% | |
arrange(salary) | |
salary_labels <- filter(salaries, rank == "Professor" | | |
rank == "Assistant" | | |
rank == "Associate") | |
salaries$discipline <- ordered(salaries$discipline, | |
levels = full_salary$discipline) | |
salaries$rank <- ordered(salaries$rank, | |
levels = c("New assistant", | |
"Assistant", | |
"Associate", | |
"Professor")) | |
breaks <- seq(0e3, 165e3, 10e3) | |
labels <- breaks %.% str_replace("(.+)000", "\\1K") | |
nice_thousands <- function(value) { | |
text <- round(value / 1e3, digits = 0) * 1000 | |
text <- str_replace(as.character(text), "(.+)000", "\\1K") | |
return(text) | |
} | |
attribution <- function(footnoteText = format(Sys.time(), "%d %b %Y"), | |
size= 0.9, | |
color= "gray8") { | |
require(grid) | |
pushViewport(viewport()) | |
grid.text(label= footnoteText , | |
x = unit(1,"npc") - unit(2, "mm"), | |
y= unit(2, "mm"), | |
just=c("right", "bottom"), | |
gp=gpar(cex= size, col=color)) | |
popViewport() | |
} | |
plot_institution <- ggplot(data = salaries) + | |
geom_bar(aes(x = discipline, y = salary, fill = rank, group = NA), | |
stat = "identity", position = "dodge") + | |
facet_wrap(~ institution_type, ncol = 1) + | |
coord_flip() + | |
theme(legend.position = "bottom", | |
axis.text.y = element_text(color = "black", size = rel(1.1)), | |
strip.text = element_text(color = "black", size = rel(1.25)), | |
title = element_text(size = rel(1.25))) + | |
scale_y_continuous(breaks = breaks, labels = labels) + | |
geom_hline(yintercept = breaks, color = "white") + | |
geom_hline(data = avg_salaries, aes(yintercept = salary), | |
size = 1, color = "gray18") + | |
geom_text(data = salary_labels, | |
aes(x = discipline, y = (salary - 2.1e3), fill = rank, | |
label = nice_thousands(salary)), | |
color = "gray8", size = 2.5) + | |
xlab(NULL) + ylab(NULL) + | |
scale_fill_brewer(palette = "Paired") + | |
ggtitle("Faculty Salaries by Discipline, Rank, and Institution Type, 2013-14") | |
plot_discipline <- ggplot(data = salaries) + | |
geom_bar(aes(x = institution_type, y = salary, fill = rank, group = NA), | |
stat = "identity", position = "dodge") + | |
facet_wrap(~ discipline, ncol = 1) + | |
coord_flip() + | |
theme(legend.position = "bottom", | |
axis.text.y = element_text(color = "black", size = rel(1.1)), | |
strip.text = element_text(color = "black", size = rel(1.25)), | |
title = element_text(size = rel(1.5))) + | |
scale_y_continuous(breaks = breaks, labels = labels) + | |
geom_hline(yintercept = breaks, color = "white") + | |
geom_text(data = salary_labels, | |
aes(x = institution_type, y = (salary - 2.1e3), fill = rank, | |
label = nice_thousands(salary)), | |
color = "gray8", size = 2.5) + | |
xlab(NULL) + ylab(NULL) + | |
scale_fill_brewer(palette = "Paired") + | |
ggtitle("Faculty Salaries by Discipline, Rank, and Institution Type, 2013-14") | |
svg("faculty-salaries-by-discipine.svg", width = 14, height = 32) | |
print(plot_discipline) | |
attribution("Data: Chronicle of Higher Education; Visualization: Lincoln Mullen <http://lincolnmullen.com>") | |
dev.off() | |
svg("faculty-salaries-by-institution.svg", width = 14, height = 38) | |
print(plot_institution) | |
attribution("Data: Chronicle of Higher Education; Visualization: Lincoln Mullen <http://lincolnmullen.com>") | |
dev.off() | |
pdf("faculty-salaries-by-institution.pdf", width = 14, height = 32) | |
print(plot_institution) | |
attribution("Data: Chronicle of Higher Education; Visualization: Lincoln Mullen <http://lincolnmullen.com>") | |
dev.off() | |
pdf("faculty-salaries-by-discipline.pdf", width = 14, height = 38) | |
print(plot_discipline) | |
attribution("Data: Chronicle of Higher Education; Visualization: Lincoln Mullen <http://lincolnmullen.com>") | |
dev.off() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rank | discipline | All_institutions | Research_university | Other_doctoral | Masters | Bachelors | |
---|---|---|---|---|---|---|---|
Professor | Legal professions and studies | 143757 | 165566 | 154651 | 120878 | 115588 | |
Professor | Business, management, marketing, and related support services | 123233 | 160705 | 128738 | 109840 | 91075 | |
Professor | Engineering | 123103 | 134560 | 123439 | 103926 | 93570 | |
Associate | Legal professions and studies | 109090 | 123229 | 118833 | 92674 | 91696 | |
Professor | Computer and information sciences and support services | 108679 | 134262 | 112007 | 100284 | 89815 | |
Professor | Architecture and related services | 107143 | 108710 | 96930 | |||
New assistant | Business, management, marketing, and related support services | 107066 | 131401 | 109187 | 95176 | 73870 | |
Associate | Business, management, marketing, and related support services | 104153 | 128762 | 108483 | 96210 | 79333 | |
Professor | Health professions and related programs | 103501 | 123331 | 93532 | 90950 | 82504 | |
New assistant | Legal professions and studies | 100791 | 102276 | 112423 | 93877 | ||
Professor | Area, ethnic, cultural, gender and group studies | 100469 | 109435 | 90038 | 89173 | 103400 | |
Assistant | Business, management, marketing, and related support services | 100197 | 127158 | 104136 | 91454 | 74118 | |
Professor | Biological and biomedical sciences | 99598 | 122606 | 104319 | 84164 | 80854 | |
Professor | Agriculture, agriculture operations, and related sciences | 97883 | 105994 | 85582 | 84837 | 83532 | |
Professor | Natural resources and conservation | 97796 | 105789 | 97687 | 85048 | 89150 | |
Professor | All disciplines combined | 97784 | 119265 | 100647 | 89032 | 83857 | |
Professor | Multi/interdisciplinary studies | 97735 | 118085 | 99258 | 86622 | 85088 | |
Professor | Public administration and social-service professions | 96120 | 117088 | 96048 | 83403 | 72726 | |
Professor | Social sciences | 95718 | 114474 | 97190 | 87572 | 89378 | |
Professor | Family and consumer sciences/human sciences | 94892 | 109247 | 90963 | 80337 | 72129 | |
Assistant | Legal professions and studies | 94436 | 107158 | 98760 | 83760 | 85216 | |
Professor | Physical sciences | 94121 | 116011 | 94666 | 85719 | 84251 | |
Associate | Engineering | 93768 | 98685 | 93654 | 86273 | 78018 | |
Professor | Engineering technologies and engineering-related fields | 92938 | 119253 | 94573 | 89595 | 72692 | |
Professor | Psychology | 90924 | 113306 | 92389 | 85111 | 82019 | |
Professor | Philosophy and religious studies | 90607 | 105204 | 97254 | 85383 | 86303 | |
Professor | Mathematics and statistics | 90508 | 109249 | 93479 | 84504 | 81051 | |
Professor | Foreign languages, literatures, and linguistics | 90390 | 100843 | 92178 | 81422 | 92210 | |
Professor | Library science | 90172 | 101190 | 90121 | 75051 | ||
Professor | Homeland security, law enforcement, firefighting, and related protective services | 89978 | 113525 | 91198 | 85207 | 70558 | |
Professor | Communication, journalism, and related programs | 89832 | 108083 | 94386 | 84519 | 75249 | |
Associate | Computer and information sciences and support services | 89684 | 105021 | 91351 | 85765 | 77260 | |
Professor | Education | 89335 | 104675 | 90920 | 84146 | 75010 | |
Professor | Liberal arts and sciences, general studies and humanities | 87070 | 100142 | 95297 | 83869 | 78171 | |
Professor | History general | 86636 | 102981 | 89009 | 82743 | 81485 | |
Professor | Communications technologies/technicians and support services | 86128 | 84309 | ||||
Professor | English language and literature/letters | 85404 | 100552 | 87701 | 82386 | 79856 | |
Professor | Parks, recreation, leisure, and fitness studies | 85246 | 109360 | 87512 | 80609 | 71209 | |
Professor | Visual and performing arts | 84349 | 93767 | 89882 | 80019 | 81369 | |
New assistant | Engineering | 82342 | 85098 | 85778 | 77027 | 62681 | |
Assistant | Engineering | 81592 | 85166 | 81263 | 76591 | 68900 | |
New assistant | Computer and information sciences and support services | 81233 | 91606 | 78328 | 77604 | 64506 | |
Associate | Health professions and related programs | 80235 | 90905 | 74207 | 75342 | 67498 | |
Professor | Theology and religious vocations | 79612 | 113118 | 79764 | 77975 | 70444 | |
Associate | Architecture and related services | 79300 | 79540 | 82164 | 79004 | ||
Assistant | Computer and information sciences and support services | 77502 | 90654 | 80371 | 73964 | 64383 | |
Associate | Engineering technologies and engineering-related fields | 77164 | 85412 | 76184 | 76820 | 63665 | |
Associate | Area, ethnic, cultural, gender and group studies | 77005 | 79645 | 77231 | 71083 | 80983 | |
Associate | Agriculture, agriculture operations, and related sciences | 76663 | 81103 | 73648 | 67949 | 73633 | |
Associate | All disciplines combined | 76193 | 87731 | 78681 | 72236 | 67088 | |
Associate | Multi/interdisciplinary studies | 75027 | 83808 | 72099 | 71548 | 70094 | |
Associate | Natural resources and conservation | 74364 | 77957 | 82770 | 68847 | 67027 | |
Associate | Public administration and social-service professions | 73975 | 83666 | 75674 | 69806 | 59960 | |
Associate | Biological and biomedical sciences | 73950 | 85528 | 80058 | 66620 | 63671 | |
Associate | Social sciences | 73391 | 82386 | 75628 | 69228 | 70175 | |
Associate | Family and consumer sciences/human sciences | 72727 | 79091 | 69651 | 66640 | 62423 | |
Associate | Physical sciences | 71868 | 83669 | 72462 | 67642 | 66168 | |
Associate | Communications technologies/technicians and support services | 71280 | 67681 | ||||
Associate | Mathematics and statistics | 70458 | 80929 | 73124 | 67116 | 65062 | |
New assistant | Agriculture, agriculture operations, and related sciences | 69693 | 74614 | 58541 | |||
Associate | Education | 69444 | 75990 | 70709 | 67511 | 62693 | |
Associate | Homeland security, law enforcement, firefighting, and related protective services | 69317 | 78156 | 69545 | 68138 | 60355 | |
Associate | Library science | 69242 | 76704 | 73214 | 61015 | ||
Associate | Foreign languages, literatures, and linguistics | 69156 | 72736 | 68159 | 65612 | 70875 | |
Associate | Parks, recreation, leisure, and fitness studies | 69066 | 79001 | 68866 | 66854 | 62010 | |
Associate | Communication, journalism, and related programs | 68973 | 76804 | 71268 | 67580 | 61769 | |
Associate | Psychology | 68834 | 78483 | 70720 | 66597 | 63939 | |
New assistant | Health professions and related programs | 68605 | 76930 | 66759 | 64988 | 55200 | |
Associate | Liberal arts and sciences, general studies and humanities | 68120 | 75651 | 70090 | 66783 | 63840 | |
Assistant | Engineering technologies and engineering-related fields | 68051 | 75125 | 69725 | 66433 | 59911 | |
Associate | Philosophy and religious studies | 67994 | 74968 | 71860 | 65267 | 66102 | |
Assistant | Health professions and related programs | 67718 | 74951 | 64874 | 64815 | 58505 | |
New assistant | All disciplines combined | 67428 | 76140 | 68711 | 62770 | 56341 | |
New assistant | Engineering technologies and engineering-related fields | 66779 | 72033 | 69706 | 65396 | ||
Assistant | All disciplines combined | 66177 | 76061 | 68971 | 62707 | 57616 | |
Assistant | Agriculture, agriculture operations, and related sciences | 66107 | 70764 | 61850 | 59703 | 56024 | |
Associate | Visual and performing arts | 65812 | 70737 | 68386 | 63865 | 63813 | |
Associate | History general | 65801 | 73480 | 68106 | 64004 | 62781 | |
Associate | English language and literature/letters | 65601 | 72555 | 66609 | 64384 | 62570 | |
Assistant | Architecture and related services | 65484 | 66274 | 65738 | 61370 | ||
New assistant | Social sciences | 64546 | 72149 | 62739 | 59467 | 59870 | |
Associate | Theology and religious vocations | 64259 | 78383 | 63908 | 61693 | 60326 | |
New assistant | Area, ethnic, cultural, gender and group studies | 63950 | 67485 | 54558 | 60584 | ||
New assistant | Biological and biomedical sciences | 63950 | 73375 | 65190 | 57209 | 54334 | |
New assistant | Architecture and related services | 63932 | 64900 | ||||
New assistant | Physical sciences | 63448 | 72360 | 59542 | 57686 | 55357 | |
Assistant | Biological and biomedical sciences | 63343 | 73659 | 67342 | 57554 | 54977 | |
New assistant | Public administration and social-service professions | 62984 | 69812 | 62553 | 58622 | ||
New assistant | Communications technologies/technicians and support services | 62983 | |||||
Assistant | Multi/interdisciplinary studies | 62949 | 67181 | 69482 | 60109 | 58173 | |
Assistant | Natural resources and conservation | 62941 | 67533 | 63892 | 58661 | 56737 | |
Assistant | Social sciences | 62791 | 70292 | 64568 | 59397 | 59798 | |
New assistant | Mathematics and statistics | 62780 | 72421 | 63253 | 56916 | 55326 | |
Assistant | Area, ethnic, cultural, gender and group studies | 62571 | 64924 | 59179 | 57940 | 65916 | |
New assistant | Family and consumer sciences/human sciences | 62448 | 66821 | 60593 | 56228 | ||
New assistant | Library science | 62176 | 65585 | 56393 | |||
Assistant | Physical sciences | 61851 | 72312 | 63149 | 57630 | 56112 | |
New assistant | Natural resources and conservation | 61798 | 67562 | 57678 | |||
Assistant | Family and consumer sciences/human sciences | 61790 | 66396 | 59034 | 57248 | ||
Assistant | Public administration and social-service professions | 61509 | 69120 | 61233 | 58768 | 50831 | |
Assistant | Mathematics and statistics | 60837 | 73156 | 62685 | 57433 | 54716 | |
Assistant | Communications technologies/technicians and support services | 60018 | 60841 | ||||
Assistant | Library science | 59718 | 65330 | 60217 | 54514 | ||
New assistant | Parks, recreation, leisure, and fitness studies | 59270 | 67076 | 61049 | 55521 | 51633 | |
Assistant | Psychology | 59166 | 67627 | 61242 | 56915 | 54966 | |
New assistant | Psychology | 59065 | 67835 | 59983 | 55650 | 54606 | |
Assistant | Education | 58986 | 63568 | 60823 | 57816 | 53738 | |
New assistant | Multi/interdisciplinary studies | 58909 | 64468 | 57953 | 51465 | ||
Assistant | Homeland security, law enforcement, firefighting, and related protective services | 58783 | 66009 | 60311 | 58295 | 53023 | |
New assistant | Communication, journalism, and related programs | 58482 | 63299 | 60467 | 56553 | 51506 | |
Assistant | Parks, recreation, leisure, and fitness studies | 58341 | 66889 | 61681 | 56576 | 51765 | |
New assistant | Education | 58278 | 63204 | 60249 | 55870 | 53043 | |
New assistant | Homeland security, law enforcement, firefighting, and related protective services | 58052 | 62990 | 57075 | 57758 | 51714 | |
Assistant | Communication, journalism, and related programs | 58031 | 62796 | 61679 | 56847 | 52583 | |
Assistant | Foreign languages, literatures, and linguistics | 57804 | 60889 | 58497 | 55212 | 58284 | |
Assistant | Philosophy and religious studies | 57251 | 61489 | 61271 | 55110 | 55595 | |
Assistant | Liberal arts and sciences, general studies and humanities | 57237 | 63170 | 55970 | 52328 | ||
New assistant | Foreign languages, literatures, and linguistics | 56727 | 61234 | 55707 | 53226 | 55032 | |
Assistant | Theology and religious vocations | 56604 | 70881 | 57749 | 55589 | 51772 | |
Assistant | History general | 56411 | 60770 | 58632 | 54755 | 55204 | |
New assistant | Philosophy and religious studies | 56212 | 60735 | 57551 | 54084 | 52806 | |
New assistant | Liberal arts and sciences, general studies and humanities | 56083 | 60659 | 50068 | |||
New assistant | English language and literature/letters | 55987 | 60269 | 55961 | 53903 | 53949 | |
New assistant | Theology and religious vocations | 55876 | 50337 | ||||
Assistant | English language and literature/letters | 55716 | 60667 | 58039 | 54257 | 53992 | |
New assistant | History general | 55691 | 60130 | 56504 | 52106 | 54138 | |
Assistant | Visual and performing arts | 55544 | 58543 | 57851 | 54234 | 54121 | |
New assistant | Visual and performing arts | 54671 | 57641 | 53140 | 53261 | 53440 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment