Getting economic data from tidyquant package
ca_claims <-
"CAICLAIMS" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
ca_claims %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "Count",
y = "Time",
title = "New Unemployment Claims _ California",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("Weekly from {min(ca_claims$date)} through {max(ca_claims$date)}")
) +
theme_economist()
library(knitr)
## Warning: package 'knitr' was built under R version 3.6.3
library(kableExtra)
##
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
##
## group_rows
tail(ca_claims[,1:2]) %>%
kable() %>%
kable_paper(full_width=F) %>%
column_spec(1, color = "blue") %>%
column_spec(2, color = "red") %>%
kable_styling()
date | claims |
---|---|
2020-08-29 | 219563 |
2020-09-05 | 243404 |
2020-09-12 | 226004 |
2020-09-19 | 226179 |
2020-09-26 | 226179 |
2020-10-03 | 226179 |
ca_claims<- ca_claims %>%
mutate(
year = year(date),
month = month(date, label = T, abbr = T),
week = week(date))
ca_month <- ca_claims %>%
group_by(year,month)%>%
summarise(Ave_count =sum(claims))
## `summarise()` regrouping output by 'year' (override with `.groups` argument)
ggplot(data=ca_claims,aes(x=date,y = claims,fill=month)) +
geom_bar(stat = "identity")+
labs(
title = "Unemployment Claims in California",
subtitle = str_glue("{min(ca_claims$date)} through {max(ca_claims$date)}"),
caption = "Illustration by Joe Long", y = "", x = "")
ggplot(data=ca_month,aes(x=reorder(month,year),y = Ave_count,fill=month)) +
geom_bar(stat = "identity")+
labs( title = "New Unemployment Claims in California",
subtitle = "Past 12 moths", x="",y="",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego")
par(mfrow=c(2,1))
sdurn <-
"CASAND5URN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
sdurn %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Rate : San Diego (CASAND5URN)",
subtitle = str_glue("From {min(sdurn$date)} through {max(sdurn$date)}"),
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego")+
theme_economist() +
scale_y_continuous(labels = scales::comma)
sdun <-
"LAUCN060730000000004" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
sdun %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Population San Diego ",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(sdun$date)} through {max(sdun$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
sdlabor <-
"CASAND5LFN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
sdlabor %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "",
title = "Civilian Labor Force in San Diego County, CA (CASAND5LFN)",
subtitle = str_glue("From {min(sdlabor$date)} through {max(sdlabor$date)}"),
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego")+
theme_economist() +
scale_y_continuous(labels = scales::comma)
rsurn <-
"CARIVE5URN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
rsurn %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "darkgreen",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Rate _ Riverside County (CARIVE5URN)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(rsurn$date)} through {max(rsurn$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
rsun <-
"LAUCN060650000000004" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
rsun %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "darkgreen",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Population _ Riverside County (LAUCN060650000000004)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(rsun$date)} through {max(rsun$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
#---------------------
rslabor <-
"CARIVE5LFN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
rslabor %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "darkgreen",size=1) +
labs(
x = "",
y = "",
title = "Civilian Labor Force in Riverside County, CA (CARIVE5LFN)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(rslabor$date)} through {max(rslabor$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
ocurn <-
"CAORAN7URN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
ocurn %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Rate _ Orange County (CAORAN7URN)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(ocurn$date)} through {max(ocurn$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
#--------------------------------
ocun <-
"LAUCN060590000000004" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
ocun %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Population _ Orange County (LAUCN060590000000004)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(ocun$date)} through {max(ocun$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
#------------------------
oclabor <-
"CAORAN7LFN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
oclabor %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "",
title = "Civilian Labor Force in Orange County, CA (CAORAN7LFN)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(oclabor$date)} through {max(oclabor$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
laurn <-
"CALOSA7URN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
laurn %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "darkblue",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Rate _ Los Angeles County (CALOSA7URN)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(laurn$date)} through {max(laurn$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
#--------------------------------
laun <-
"LAUCN060370000000004" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
laun %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "darkblue",size=1) +
labs(
x = "",
y = "",
title = "Unemployment Population _ Los Angeles County (LAUCN060370000000004)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(laun$date)} through {max(laun$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)
#------------------------
lalabor <-
"CALOSA7LFN" %>%
tq_get(get = "economic.data",
from = "2019-01-01") %>%
rename(claims = price)
lalabor %>%
ggplot(aes(x = date, y = claims)) +
geom_rect(aes(xmin= dmy('01-01-2020'), xmax=dmy('01-10-2020'), ymin = -Inf, ymax = Inf),
fill = "white", alpha = 0.04)+
geom_line(color = "blue",size=1) +
labs(
x = "",
y = "count",
title = "Civilian Labor Force in Los Angeles County, CA (CALOSA7LFN)",
caption = "Data source: FRED St. Louis Federal Reserve \nIllustration by @JoeLongSanDiego",
subtitle = str_glue("From {min(lalabor$date)} through {max(lalabor$date)}")
) +
theme_economist() +
scale_y_continuous(labels = scales::comma)