Data Study on NYC Job posting and Salary Trends
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.
Contributed by Wansang Lim. He is currently in theย NYC Data Science Academyย 12 week full time Data Science Bootcampย program taking place between January 11th to April 1st, 2016. This post is based on his second class project - R Shiny (due on the 4th week of theย program).
This shiny web is designed to search government job and compare New York City job posting to understand NYC job trends.
Government Job Search
U.S Government has job search API ( https://search.digitalgov.gov/developer/jobs.html ). Federal, state, and local government agencies are hiring and have thousands of job openings across the country, posted on USAJobs.gov and local government jobs sites. This Jobs API allows you to tap into a data list of current jobs openings with the government. Jobs are searchable by keyword, location, agency, schedule, or any combination of these. It is great for job websites or applications, job banks, and career counseling and placement application.
If we search job title, the main map shows opening job location. the red circle is proportional with the proposed salary. And the small map shows actual salary. One of technical achievement is that real time data conversion with API. The job serach API does not give us location ordinate. Google Maps Geocoding API converts address to longitude and latitude.
After searching job, the detailed information is in job table.
What and where is this data?
New York city posts job posting in web site(https://www1.nyc.gov/jobs/index.page). The all data can be downloaded from https://data.cityofnewyork.us/City-Government/NYC-Jobs/kpav-sd4t .
- The csv file has 3826 rows and 26 columns.
-The duration of job posting is form 2011 to 2016/01
The object of NYC job
This app is made to help users to understand to trend of NYC job posting and salary by various categories.
App Structure
- Build 5 for 5 different analysis and make into on big App with radio buttons
- Because Different analysis has different data structure
- And finally, it shows NYC job location graphically in map by Agency.
Data Analysis Procedure
- histogram with all data with 3 different salary(minimun, maximum, average
Salary change of NYC jobs by time

At the time beginning, all salaries fluctuate a lot. However when time goes by, it became stable. One of the reason is that in the beginning there is not much NYC posting in web site.
NYC job posting analysis
- histogram with position level
- There are some outliers in histogram by level.
The outliers were grouped by job title for salary to see what and who they are.
- Salary change with time
Conclusion
- The frequent average salary is $50,000 ~ 70,000
- Level is realted with salary
- Medical job has higher salary even if it is in lower level
- Job opening increased exponentially after December 2014(very curious!!!)
- Average salary show less variation after December 2014
NYC job posting Information
This map shows the NYC job locations. The circle represents the number of jobs in the locations. Sometimes, an agency post multiple jobs in one location. And the box plot shows the distribution of age. At the bottom, there is table for detailed information.
Code
- ui.R
library(shiny)
shinyUI(fluidPage(
Application title
titlePanel("NYC Job Posting Data"),
Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
radioButtons("radio", label = h3("Whole or Part"),
choices = list("Whole Histogram" = 1, "Histogram by Level" = 2,
"Outlier or Not" = 3, "Salary by Time" = 4),
selected = 1),
conditionalPanel(condition = "input.radio == 1",
sliderInput("bins",
"Number of bars:",
min = 1,
max = 50,
value = 30),
selectInput("salary", "Choose a salary",
choices = c("minimum", "maximum", "average"))
),
conditionalPanel(condition = "input.radio == 2",
selectInput("salaryByLevel", "Choose a salary",
choices = c("minimum", "maximum", "average"))
),
conditionalPanel(condition = "input.radio == 3",
selectInput("OutNot", "Choose outlier or not",
choices = c("Outlier", "No Outlier"))
),
conditionalPanel(condition = "input.radio == 4",
radioButtons("radioTime", label = h3("Whole or Part"),
choices = list("Whole Data" = 1, "Part Data" = 2 ),
selected = 1),
#selectInput("wholePart", "Choose whole data or part data",choices = c("whole", "part")),
conditionalPanel(condition = "input.radioTime == 2",
sliderInput("rowNum",
"Start Year/Month:",
min = 1,
max = 29,
value = 1)
),
selectInput("salaryTime", "Choose a number or salary",
choices = c("total number", "minimum", "maximum", "average"))
)
),
Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
h4("Downloaded from "),
h5("- https://data.cityofnewyork.us/City-Government/NYC-Jobs/kpav-sd4t"),
)
)
))
- server.R
library(shiny)
library(ggplot2)
shinyServer(function(input, output) {
#data input
dataSalHis <- read.csv("../dataSalHis.csv", stringsAsFactors=FALSE) #1 Graph
dataLevel <- read.csv("../levelPlotDa.csv", stringsAsFactors=TRUE) # 2 Graph
compareOut <- read.csv("../compareOut.csv") # 3 Graph
salaryByYYMM <- read.csv("../salaryByYYMM.csv")
output$distPlot <- renderPlot({
startYYMM <-input$rowNum
endYYMM <- startYYMM + 9
partData <- salaryByYYMM[startYYMM:endYYMM,]
salaryInput <- reactive( {
switch(
input$salary,
"minimum" = 2,
"maximum" = 3,
"average" = 4)
})
salaryLevelInput <- reactive( {
switch(
input$salaryByLevel,
"minimum" = 4,
"maximum" = 5,
"average" = 6)
})
outOrNot <- reactive({
switch(
input$OutNot,
"Outlier" = 1,
"No Outlier" = 2
)
})
salaryTimeInput <- reactive( {
switch(
input$salaryTime,
"total number" = "total",
"minimum" = "SalaryFromAve" ,
"maximum" = "SalaryToAve" ,
"average" = "SalaryAveAve" )
})
aa <- salaryInput()
x <- dataSalHis[, aa]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
columnSel <- salaryLevelInput()
choice <- outOrNot()
colName <- salaryTimeInput()
#Graph output
if (input$radio == 1) {
hist(x, breaks = bins, col = 'darkgray', border = 'white') #whole hist 1
} else if (input$radio == 2) {
plot(dataLevel[, 3], dataLevel[, columnSel]) # hist by Level
} else if (input$radio == 3) {
if (choice == 1) {
barGraph <- ggplot(compareOut, aes(x=OTitle, y=OAver)) + geom_bar(stat="identity")
barGraph + theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 12), panel.background = element_blank())
} else if (choice == 2) {
barGraph <- ggplot(compareOut, aes(x=NTitle, y=NAver)) + geom_bar(stat="identity")
barGraph + theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 12), panel.background = element_blank())
}
} else if (input$radio == 4) {
if (input$radioTime == 1) {
if (colName == "total") {
graphYYMM <- qplot(Posting.YYMM, total, data = salaryByYYMM)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
} else if (colName == "SalaryFromAve") {
graphYYMM <- qplot(Posting.YYMM, SalaryFromAve, data = salaryByYYMM)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
} else if (colName == "SalaryToAve") {
graphYYMM <- qplot(Posting.YYMM, SalaryToAve, data = salaryByYYMM)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
} else if (colName == "SalaryAveAve") {
graphYYMM <- qplot(Posting.YYMM, SalaryAveAve, data = salaryByYYMM)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
}
} else if (input$radioTime == 2) {
if (colName == "total") {
graphYYMM <- qplot(Posting.YYMM, total, data = partData)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
} else if (colName == "SalaryFromAve") {
graphYYMM <- qplot(Posting.YYMM, SalaryFromAve, data = partData)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
} else if (colName == "SalaryToAve") {
graphYYMM <- qplot(Posting.YYMM, SalaryToAve, data = partData)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
} else if (colName == "SalaryAveAve") {
graphYYMM <- qplot(Posting.YYMM, SalaryAveAve, data = partData)
graphYYMM + theme(axis.text.x = element_text(angle = 45, hjust = 1),
panel.background = element_blank())
}
}
}
}) #output$distPlot
})