Unemployment Rate

black <-fredr_series_observations(series_id = "LNS14000006",
        observation_start = as.Date("2019-01-01")) 
hispanic <-fredr_series_observations(series_id = "LNS14000009",
        observation_start = as.Date("2019-01-01")) 
white <-fredr_series_observations(series_id = "LNS14000003",
        observation_start = as.Date("2019-01-01")) 
asian <-fredr_series_observations(series_id = "LNU04032183",
        observation_start = as.Date("2019-01-01")) 

str(black)
## tibble [19 x 3] (S3: tbl_df/tbl/data.frame)
##  $ date     : Date[1:19], format: "2019-01-01" "2019-02-01" ...
##  $ series_id: chr [1:19] "LNS14000006" "LNS14000006" "LNS14000006" "LNS14000006" ...
##  $ value    : num [1:19] 6.8 6.9 6.6 6.6 6.2 6 5.9 5.4 5.5 5.5 ...
indicator <-as.data.frame(black$date)

colnames(indicator) <- "date"
indicator$black <- black$value
indicator$hispanic <- hispanic$value
indicator$white <- white$value
indicator$asian <- asian$value



indicator %>% kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
   column_spec(2, T, color = "black" ) %>%
  column_spec(3, T, color = "blue") %>%
  column_spec(4, T, color = "green") %>%
   column_spec(5, T, color = "red") 
date black hispanic white asian
2019-01-01 6.8 4.8 3.5 3.2
2019-02-01 6.9 4.3 3.3 3.2
2019-03-01 6.6 4.7 3.4 3.0
2019-04-01 6.6 4.2 3.1 2.1
2019-05-01 6.2 4.2 3.3 2.3
2019-06-01 6.0 4.3 3.3 2.3
2019-07-01 5.9 4.5 3.3 3.0
2019-08-01 5.4 4.2 3.4 2.9
2019-09-01 5.5 3.9 3.2 2.4
2019-10-01 5.5 4.1 3.2 2.8
2019-11-01 5.6 4.2 3.2 2.6
2019-12-01 5.9 4.2 3.2 2.4
2020-01-01 6.0 4.3 3.1 3.2
2020-02-01 5.8 4.4 3.1 2.5
2020-03-01 6.7 6.0 4.0 4.1
2020-04-01 16.7 18.9 14.2 14.3
2020-05-01 16.8 17.6 12.4 14.8
2020-06-01 15.4 14.5 10.1 13.9
2020-07-01 14.6 12.9 9.2 12.2
#---------------------------
library(reshape2)

# Specify id.vars: the variables to keep but not split apart on
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Race","Percent")

# plotting data
data_long %>% ggplot() + 
  geom_line(mapping = aes(x=date,y=Percent,color=Race),size=1)  +
        
   labs(title = "Unemployment rates by races", 
       subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
       x="Monthly", y="Percent",
       caption = "Data source: FRED Federal Reserve.   Illustration by @JoeLongSanDiego")+
    theme_economist()

Employment Level

black <-fredr_series_observations(series_id = "LNS12000006",
        observation_start = as.Date("2019-01-01")) 
hispanic <-fredr_series_observations(series_id = "LNS12000009",
        observation_start = as.Date("2019-01-01")) 
white <-fredr_series_observations(series_id = "LNS12000003",
        observation_start = as.Date("2019-01-01")) 
asian <-fredr_series_observations(series_id = "LNU02032183",
        observation_start = as.Date("2019-01-01")) 


indicator <-as.data.frame(black$date)

colnames(indicator) <- "date"
indicator$black <- black$value
indicator$hispanic <- hispanic$value
indicator$white <- white$value
indicator$asian <- asian$value



indicator %>% kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
   column_spec(2, T, color = "black" ) %>%
  column_spec(3, T, color = "blue") %>%
  column_spec(4, T, color = "green") %>%
   column_spec(5, T, color = "red") 
date black hispanic white asian
2019-01-01 19211 27558 121812 9938
2019-02-01 19140 27499 122119 10053
2019-03-01 19093 27562 122111 10133
2019-04-01 19235 27364 121964 9954
2019-05-01 19302 27507 121970 10049
2019-06-01 19216 27621 122199 10361
2019-07-01 19502 27610 122213 10205
2019-08-01 19485 27876 122566 10248
2019-09-01 19550 28156 122955 10261
2019-10-01 19571 28279 123028 10371
2019-11-01 19527 28339 123077 10391
2019-12-01 19712 28286 123175 10189
2020-01-01 19549 28397 123332 9932
2020-02-01 19730 28531 123189 10327
2020-03-01 19208 27672 121042 10058
2020-04-01 16240 22579 104065 8476
2020-05-01 16523 23241 107499 8462
2020-06-01 16927 24711 111538 8786
2020-07-01 17161 24885 112226 9207
#---------------------------

# Specify id.vars: the variables to keep but not split apart on
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Race","Percent")

# plotting data
data_long %>% ggplot() + 
  geom_line(mapping = aes(x=date,y=Percent,color=Race),size=1)  +
        
   labs(title = "Employment Levels by Races", 
       subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
       x="Monthly", y="Thousands of Persons",
       caption = "Data source: FRED Federal Reserve.   Illustration by @JoeLongSanDiego")+
    theme_economist()

Employment Level by gender

women <-fredr_series_observations(series_id = "LNU04000002",
        observation_start = as.Date("2019-01-01")) 
men <-fredr_series_observations(series_id = "LNU04000001",
        observation_start = as.Date("2019-01-01")) 



indicator <-as.data.frame(women$date)

colnames(indicator) <- "date"
indicator$women <- women$value
indicator$men <- men$value


indicator %>% kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
   column_spec(2, T, color = "black" ) %>%
  column_spec(3, T, color = "blue")
date women men
2019-01-01 4.1 4.7
2019-02-01 3.8 4.4
2019-03-01 3.5 4.3
2019-04-01 3.1 3.6
2019-05-01 3.3 3.4
2019-06-01 4.0 3.7
2019-07-01 4.3 3.7
2019-08-01 4.1 3.5
2019-09-01 3.4 3.3
2019-10-01 3.3 3.3
2019-11-01 3.3 3.3
2019-12-01 3.2 3.5
2020-01-01 3.7 4.2
2020-02-01 3.4 4.1
2020-03-01 4.2 4.8
2020-04-01 15.7 13.3
2020-05-01 14.3 11.9
2020-06-01 12.0 10.5
2020-07-01 11.3 9.7
#---------------------------

# Specify id.vars: the variables to keep but not split apart on
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Gender","Thousands")

# plotting data
data_long %>% ggplot() + 
  geom_line(mapping = aes(x=date,y=Thousands,color=Gender),size=1)  +
        
   labs(title = "Unemployment Rates by Genders", 
       subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
       x="Monthly", y="Rate",
       caption = "Data source: FRED Federal Reserve.   Illustration by @JoeLongSanDiego")+
    theme_economist()

Employment Level by gender

women <-fredr_series_observations(series_id = "LNU02000002",
        observation_start = as.Date("2019-01-01")) 
men <-fredr_series_observations(series_id = "LNU02000001",
        observation_start = as.Date("2019-01-01")) 



indicator <-as.data.frame(women$date)

colnames(indicator) <- "date"
indicator$women <- women$value
indicator$men <- men$value


indicator %>% kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
   column_spec(2, T, color = "black" ) %>%
  column_spec(3, T, color = "blue")
date women men
2019-01-01 73166 81798
2019-02-01 73857 82311
2019-03-01 73835 82606
2019-04-01 73747 82963
2019-05-01 73591 83561
2019-06-01 73639 84189
2019-07-01 73587 84798
2019-08-01 73740 84077
2019-09-01 74616 83862
2019-10-01 75149 83918
2019-11-01 74971 83973
2019-12-01 75036 83467
2020-01-01 74292 82701
2020-02-01 74970 83047
2020-03-01 73373 81794
2020-04-01 61516 71810
2020-05-01 63457 74004
2020-06-01 66386 76425
2020-07-01 67117 77375
#---------------------------

# Specify id.vars: the variables to keep but not split apart on
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Gender","Thousands")

# plotting data
data_long %>% ggplot() + 
  geom_line(mapping = aes(x=date,y=Thousands,color=Gender),size=1)  +
        
   labs(title = "Employment Levels by Gender", 
       subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
       x="Monthly", y="Thousands of Persons",
       caption = "Data source: FRED Federal Reserve.   Illustration by @JoeLongSanDiego")+
    theme_economist()

Employment level Age brackets

group1 <-fredr_series_observations(series_id = "LNS12000012",
        observation_start = as.Date("2019-01-01")) 
group2 <-fredr_series_observations(series_id = "LNU02000036",
        observation_start = as.Date("2019-01-01")) 
group3 <-fredr_series_observations(series_id = "LNS12000089",
        observation_start = as.Date("2019-01-01")) 
group4 <-fredr_series_observations(series_id = "LNU02000091",
        observation_start = as.Date("2019-01-01")) 
group5 <-fredr_series_observations(series_id = "LNS12000093",
        observation_start = as.Date("2019-01-01")) 



indicator <-as.data.frame(group1$date)

colnames(indicator) <- "date"
indicator$'[16 19]' <- group1$value
indicator$'[20 24]' <- group2$value
indicator$'[25 34]' <- group3$value
indicator$'[35 44]' <- group4$value
indicator$'[45 54]' <- group5$value



indicator %>% kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
   column_spec(2, T, color = "black" ) %>%
  column_spec(3, T, color = "blue") %>%
  column_spec(4, T, color = "green") %>%
  column_spec(5, T, color = "darkorange") %>%
  column_spec(6, T, color = "red")
date [16 19] [20 24] [25 34] [35 44] [45 54]
2019-01-01 5149 13567 35615 32732 32201
2019-02-01 5019 13821 35566 32965 32144
2019-03-01 5115 13925 35682 32785 32216
2019-04-01 4951 14114 35586 33001 32162
2019-05-01 5044 14288 35628 33080 32045
2019-06-01 5159 14699 35725 32933 31994
2019-07-01 5250 14787 35506 32904 31851
2019-08-01 5184 14337 35945 33062 31964
2019-09-01 5162 14203 35928 33581 31887
2019-10-01 5218 14337 36070 33594 31978
2019-11-01 5278 14037 36190 33459 32033
2019-12-01 5213 13947 36230 33432 32017
2020-01-01 5273 13795 36129 33255 31945
2020-02-01 5378 14069 36123 33273 31901
2020-03-01 5054 13248 35501 33050 31644
2020-04-01 3479 9951 30453 29658 27709
2020-05-01 3932 10596 31299 30163 28555
2020-06-01 4114 11669 32028 30909 29683
2020-07-01 4235 12154 32105 31215 29565
#---------------------------

# Specify id.vars: the variables to keep but not split apart on
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Age","Thousands")

# plotting data
data_long %>% ggplot() + 
  geom_line(mapping = aes(x=date,y=Thousands,color=Age),size=1)  +
        
   labs(title = "Employment Levels by Races", 
       subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
       x="Monthly", y="Thousands of Persons",
       caption = "Data source: FRED Federal Reserve.   Illustration by @JoeLongSanDiego")+
    theme_economist()

Unemployment rates by Age brackets

g1 <-fredr_series_observations(series_id = "LNS14000012",
        observation_start = as.Date("2019-01-01")) 
g2 <-fredr_series_observations(series_id = "LNS14000036",
        observation_start = as.Date("2019-01-01")) 
g3 <-fredr_series_observations(series_id = "LNS14000089",
        observation_start = as.Date("2019-01-01")) 
g4 <-fredr_series_observations(series_id = "LNS14000091",
        observation_start = as.Date("2019-01-01")) 
g5 <-fredr_series_observations(series_id = "LNS14000093",
        observation_start = as.Date("2019-01-01")) 
g6 <-fredr_series_observations(series_id = "LNU04000095",
        observation_start = as.Date("2019-01-01")) 


indicator <-as.data.frame(g1$date)

colnames(indicator) <- "date"
indicator$'[16 19]' <- g1$value
indicator$'[20 24]' <- g2$value
indicator$'[25 34]' <- g3$value
indicator$'[35 44]' <- g4$value
indicator$'[45 54]' <- g5$value


indicator %>% kable() %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed")) %>%
   column_spec(2, T, color = "black" ) %>%
  column_spec(3, T, color = "blue") %>%
  column_spec(4, T, color = "green") %>%
  column_spec(5, T, color = "darkorange") %>%
  column_spec(6, T, color = "red")
date [16 19] [20 24] [25 34] [35 44] [45 54]
2019-01-01 13 7.5 3.9 2.9 2.9
2019-02-01 13 7.2 4.0 2.6 2.8
2019-03-01 13 7.2 4.0 2.8 2.9
2019-04-01 13 6.5 3.8 2.7 2.5
2019-05-01 13 7.0 3.5 2.7 2.6
2019-06-01 13 6.3 3.6 2.8 2.7
2019-07-01 13 6.7 3.7 2.8 2.7
2019-08-01 12 7.1 3.6 2.7 2.8
2019-09-01 12 6.3 3.6 2.6 2.8
2019-10-01 12 6.2 3.7 2.6 2.6
2019-11-01 12 6.4 3.6 2.7 2.6
2019-12-01 13 6.3 3.6 2.8 2.6
2020-01-01 12 6.6 3.7 2.8 2.5
2020-02-01 11 6.4 3.7 2.8 2.5
2020-03-01 14 8.7 4.1 3.4 3.2
2020-04-01 32 25.7 14.5 11.5 12.3
2020-05-01 30 23.2 13.4 10.2 10.7
2020-06-01 23 19.8 11.7 9.1 8.3
2020-07-01 19 18.3 11.4 8.1 7.8
#---------------------------

# Specify id.vars: the variables to keep but not split apart on
data_long <- melt(indicator, id.vars=c("date"))
colnames(data_long) <- c("date","Age_Bracket","Rate")

# plotting data
data_long %>% ggplot() + 
  geom_line(mapping = aes(x=date,y=Rate,color=Age_Bracket),size=1)  +
        
   labs(title = "Unemployment rates by Age brackets", 
       subtitle = str_glue("From {min(indicator$date)} through {max(indicator$date)}"),
       x="Monthly", y="Rate",
       caption = "Data source: FRED Federal Reserve.   Illustration by @JoeLongSanDiego")+
    theme_economist()