Data Source: via Google Sheets
Source Code: via Github
Published Output: via Rpubs
First, let’s load the data that I pulled from Glassdoor’s original post. For the sake of convenience, I’ve saved this data into a publically accessable Googlesheet, from which I could import directly into RStudio with the help of the googlesheets package (available on CRAN).
require(googlesheets) # Used to access my Googlesheets
require(dplyr) # Used for data transformation
df <- gs_title("Glassdoor_Top_Jobs") %>%
gs_read_csv("2016")
From here, I used Hadley Wickham’s ggplot2 package (plus a few add-ons, namly ggthemes, RColorBrewer, and ggrepel) to plot a scatterplot of the data.
require(ggplot2) # Hadley's package for graphics
require(ggrepel) # Used for adding the labels
require(ggthemes) # Used to add the theme
require(RColorBrewer) # Used for color/fill scales
df %>% ggplot(aes(x=Career_Opportunity, y=Job_Score)) +
## Geoms
# add the points, scaling their size by their ranking & coloring by salary
geom_point(aes(size=25-Rank, color=Median_Base_Salary/1000 ), alpha=0.5) +
# label the points, filling by ranking and coloring by salary
geom_label_repel(aes(label=Job, fill=Rank, color=Median_Base_Salary/1000), size=2) +
## Add scales & labels
# scales
scale_fill_distiller(name="Label Fill:\nRanking", type = "div", palette = 4) +
scale_color_distiller(name="Median Base Salary\n(x$1,000)", type = "div", palette = 8) +
# labels
guides(size=F) + labs(x="Career Oppurtunity", y="Job Score",
title="Glassdoor's Top 25 Jobs in 2016") +
## Custom Theme: The Five Thirty Eight theme + UT Colors & Fonts
theme_fivethirtyeight() + theme(
# legends
legend.position = "right", legend.direction = "vertical",
legend.background = element_rect(fill = "transparent"),
# titles
title = element_text(color="#BF5700", family = "Georgia"),
axis.title = element_text(face = "bold"),
axis.text = element_text(color="#333F48", family = "Tahoma"))
Finally, let’s output the data table:
# Make the table look pretty
require(scales)
df$Job_Openings <- comma(df$Job_Openings)
df$Median_Base_Salary <- dollar(df$Median_Base_Salary)
# Print table to .rmd file
knitr::kable(arrange(df, Rank))
| Rank | Job | Job_Openings | Median_Base_Salary | Career_Opportunity | Job_Score |
|---|---|---|---|---|---|
| 1 | Data Scientist | 1,736 | $116,840 | 4.1 | 4.7 |
| 2 | Tax Manager | 1,574 | $108,000 | 3.9 | 4.7 |
| 3 | Solutions Architect | 2,906 | $119,500 | 3.5 | 4.6 |
| 4 | Engagement Manager | 1,356 | $125,000 | 3.8 | 4.6 |
| 5 | Mobile Developer | 2,251 | $90,000 | 3.8 | 4.6 |
| 6 | HR Manager | 3,468 | $85,000 | 3.7 | 4.6 |
| 7 | Physician Assistant | 3,364 | $97,000 | 3.5 | 4.6 |
| 8 | Product Manager | 6,607 | $106,680 | 3.3 | 4.5 |
| 9 | Software Engineer | 49,270 | $95,000 | 3.3 | 4.5 |
| 10 | Audit Manager | 1,001 | $95,000 | 3.9 | 4.5 |
| 11 | Analytics Manager | 982 | $105,000 | 3.7 | 4.5 |
| 12 | Software Development Manager | 1,199 | $135,000 | 3.4 | 4.4 |
| 13 | Product Marketing Manager | 1,111 | $115,000 | 3.5 | 4.4 |
| 14 | Marketing Manager | 2,560 | $90,000 | 3.4 | 4.4 |
| 15 | QA Manager | 3,749 | $85,000 | 3.4 | 4.4 |
| 16 | Finance Manager | 1,632 | $115,000 | 3.3 | 4.3 |
| 17 | Business Development Manager | 2,906 | $80,000 | 3.4 | 4.3 |
| 18 | UX Designer | 863 | $91,800 | 3.6 | 4.3 |
| 19 | Strategy Manager | 631 | $130,000 | 3.7 | 4.3 |
| 20 | Technical Account Manager | 1,160 | $69,548 | 3.7 | 4.2 |
| 21 | Consultant | 1,071 | $84,000 | 3.4 | 4.2 |
| 22 | Construction Superintendent | 1,054 | $78,000 | 3.4 | 4.2 |
| 23 | Nurse Practitioner | 5,624 | $99,500 | 3.1 | 4.2 |
| 24 | Electrical Engineer | 2,516 | $76,900 | 3.3 | 4.2 |
| 25 | Software Architect | 653 | $130,000 | 3.4 | 4.2 |
Hunter Ratliff
Email: hunterratliff1@gmail.com
Twitter: @HunterRatliff1
Github: HunterRatliff1
RPubs: HunterRatliff1
Copyright (C) 2016 Hunter Ratliff
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
Information About the R Session at the time it was compiled (for the purposes of Reproducible Research)
devtools::session_info()
## setting value
## version R version 3.2.3 (2015-12-10)
## system x86_64, darwin14.5.0
## ui X11
## language (EN)
## collate en_US.UTF-8
## tz America/Chicago
## date 2016-01-20
##
## package * version date source
## assertthat 0.1 2013-12-06 CRAN (R 3.2.0)
## cellranger 1.0.0 2015-06-20 CRAN (R 3.2.0)
## colorspace 1.2-6 2015-03-11 CRAN (R 3.2.0)
## curl 0.9.4 2015-11-20 CRAN (R 3.2.2)
## DBI 0.3.1 2014-09-24 CRAN (R 3.2.0)
## devtools 1.9.1 2015-09-11 CRAN (R 3.2.0)
## digest 0.6.8 2014-12-31 CRAN (R 3.2.0)
## dplyr * 0.4.3 2015-09-01 CRAN (R 3.2.0)
## evaluate 0.8 2015-09-18 CRAN (R 3.2.0)
## formatR 1.2.1 2015-09-18 CRAN (R 3.2.0)
## ggplot2 * 2.0.0 2015-12-18 CRAN (R 3.2.3)
## ggrepel * 0.4 2016-01-13 Github (slowkow/ggrepel@1e13fed)
## ggthemes * 3.0.0 2015-12-20 CRAN (R 3.2.3)
## googlesheets * 0.1.0 2015-07-05 CRAN (R 3.2.0)
## gtable 0.1.2 2012-12-05 CRAN (R 3.2.0)
## highr 0.5.1 2015-09-18 CRAN (R 3.2.0)
## htmltools 0.3 2015-12-29 CRAN (R 3.2.3)
## httr 1.0.0 2015-06-25 CRAN (R 3.2.0)
## jsonlite 0.9.19 2015-11-28 CRAN (R 3.2.2)
## knitr * 1.11 2015-08-14 CRAN (R 3.2.1)
## labeling 0.3 2014-08-23 CRAN (R 3.2.0)
## lazyeval 0.1.10 2015-01-02 CRAN (R 3.2.0)
## magrittr 1.5 2014-11-22 CRAN (R 3.2.0)
## memoise 0.2.1 2014-04-22 CRAN (R 3.2.0)
## munsell 0.4.2 2013-07-11 CRAN (R 3.2.0)
## plyr 1.8.3 2015-06-12 CRAN (R 3.2.0)
## R6 2.1.1 2015-08-19 CRAN (R 3.2.0)
## RColorBrewer * 1.1-2 2014-12-07 CRAN (R 3.2.0)
## Rcpp 0.12.2 2015-11-15 CRAN (R 3.2.2)
## rmarkdown 0.8.2 2015-11-20 Github (rstudio/rmarkdown@0d2cd06)
## scales * 0.3.0 2015-08-25 CRAN (R 3.2.0)
## stringi 1.0-1 2015-10-22 CRAN (R 3.2.0)
## stringr 1.0.0 2015-04-30 CRAN (R 3.2.0)
## xml2 0.1.2 2015-09-01 CRAN (R 3.2.0)
## yaml 2.1.13 2014-06-12 CRAN (R 3.2.0)