This analysis accompanies the TrendCT.org story: Employment in Connecticut: The long-term trend in 10 business sectors.

Here’s the data we pulled and cleaned from The Connecticut Department of Labor

How it all looks plotted together

library(dygraphs)
library(xts)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:xts':
## 
##     first, last
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
employment <- read.csv("data/employmentbysector.csv", stringsAsFactors=FALSE)
employment$Month <- strptime(employment$Month, "%m/%d/%y")
employment_time <- xts(employment[,-1], order.by=employment[,1]) 
e <- dygraph(employment_time, main="Employment by sector in Connecticut", ylab = "Employees") %>% 
  dyRangeSelector() %>%
  dyHighlight(highlightSeriesOpts = list(strokeWidth = 2)) %>%
  dyLegend(show="onmouseover", hideOnMouseOut=TRUE)
e

This is good for context on how one sector compares to another but it’s hard to distinguish each because of the similar colors.

Let’s break it out by individual category

dygraph(employment_time$Construction, main = "Construction", group = "sectors") %>% dyOptions(includeZero = TRUE)

dygraph(employment_time$Manufacturing, main = "Manufacturing", group="sectors")  %>% dyOptions(includeZero = TRUE)

dygraph(employment_time$Trade..Transportation..Utilities, main = "Trade, Transportation, Utilities", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Information, main = "Information", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Financial, main = "Financial Activities", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Professional.Business, main = "Professional Business", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Educational.and.Health.Services, main = "Educational and Health Services", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Leisure.Hospitality, main = "Leisure and Hospitality", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Other.Services, main = "Other Services", group="sectors") %>%  dyOptions(includeZero = TRUE)

dygraph(employment_time$Government, main = "Government", group = "sectors") %>%  dyOptions(includeZero = TRUE)

Interesting. Read the story for more.