senti <-
"UMCSENT" %>%
tq_get(get = "economic.data", from = "2015-01-01") %>%
rename(count = price)
senti %>%
ggplot(aes(x = date, y = count)) +
geom_line(color = "firebrick2",size=.8) +
labs(
x = "",
y = "",
title = "Consumer Sentiment Index per University of Michigan",
subtitle = str_glue("Monthly from {min(senti$date)} through {max(senti$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
gdi <-
"A4102C1Q027SBEA" %>%
tq_get(get = "economic.data", from = "2019-01-01") %>%
rename(total = price)
gdi %>%
ggplot(aes(x = date, y = total)) +
geom_line(color = "goldenrod",size=.8) +
labs(
y = "Billions of Dollars",
x = "Quarterly", caption = "GDI = A4102C1Q027SBEA",
title = "Gross Domestic Income: Compensation of employees, paid: Wages and salaries",
subtitle = str_glue("Monthly from {min(gdi$date)} through {max(gdi$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
pce <-
"NA000349Q" %>%
tq_get(get = "economic.data", from = "2018-01-01") %>%
rename(total = price)
pce %>%
ggplot(aes(x = date, y = total)) +
geom_line(color = "red4",size=.8) +
labs(
y = "Millions of Dollars",
x = "Quarterly", caption = "NA000349Q",
title = "Personal Consumption Expenditures",
subtitle = str_glue("Quarterly from {min(pce$date)} through {max(pce$date)}")) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
labor <-
"PAYEMS" %>%
tq_get(get = "economic.data", from = "2019-01-01") %>%
rename(count = price)
labor %>%
ggplot(aes(x = date, y = count)) +
geom_line(color = "firebrick4",size=.8) +
labs(
x = "",
y = "",
title = "Labor Force", caption = " ",
subtitle = str_glue("From {min(labor$date)} through {max(labor$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
u6 <-
"U6RATE" %>%
tq_get(get = "economic.data", from = "2019-01-01") %>%
rename(count = price)
u6 %>%
ggplot(aes(x = date, y = count)) +
geom_line(color = "orange",size=.8) +
labs(
x = "",
y = "",
title = "Total Unemployed", caption = " ",
subtitle = str_glue("From {min(u6$date)} through {max(u6$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
mpfe <-
"CUSR0000SAF112" %>%
tq_get(get = "economic.data", from = "2019-01-01")
mpfe %>%
ggplot(aes(x = date, y = price)) +
geom_line(color = "gold4",size=.8) +
labs(
x = "",
y = "", caption = "Index 1982-1984=100,Seasonally Adjusted",
title = "CPI : Meats, Poultry, Fish, and Eggs (CUSR0000SAF112)",
subtitle = str_glue("From {min(mpfe$date)} through {max(mpfe$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
cpi <-
"CPIAUCSL" %>%
tq_get(get = "economic.data", from = "2019-01-01") %>%
rename(count = price)
cpi %>%
ggplot(aes(x = date, y = count)) +
geom_line(color = "goldenrod4",size=.8) +
labs(
x = "",
y = "", caption = "Index 1982-1984=100,Seasonally Adjusted",
title = "Consumer Price Index: All Items in U.S. City Average (CPIAUCSL)",
subtitle = str_glue("Monthly from {min(cpi$date)} through {max(cpi$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
food <-
"CUSR0000SAF11" %>%
tq_get(get = "economic.data", from = "2019-01-01") %>%
rename(count = price)
food %>%
ggplot(aes(x = date, y = count)) +
geom_line(color = "goldenrod4",size=.8) +
labs(
x = "",
y = "", caption = "Index 1982-1984=100,Seasonally Adjusted",
title = "CPI: Food at Home in U.S. City Average (CUSR0000SAF11)",
subtitle = str_glue("Monthly from {min(food$date)} through {max(food$date)}")
) +
theme(plot.title = element_text(color="blue", size=14, face="bold"))
CPI Average Price Data, U.S. city average (AP) (Select from list below) Bacon, sliced, per lb. - APU0000704111 Bananas, per lb. - APU0000711211 Bread, white, pan, per lb. - APU0000702111 Chicken, fresh, whole, per lb. - APU0000706111 Coffee, 100%, ground roast, all sizes, per lb. - APU0000717311 Eggs, grade A, large, per doz. - APU0000708111 Flour, white, all purpose, per lb. - APU0000701111 Milk, fresh, whole, fortified, per gal. - APU0000709112 Oranges, navel, per lb. - APU0000711311 Rice, white, long grain, uncooked, per lb. - APU0000701312 Tomatoes, field grown, per lb. - APU0000712311 Electricity per KWH - APU000072610 Fuel oil #2 per gallon - APU000072511 Gasoline, all types, per gallon - APU00007471A Gasoline, unleaded regular, per gallon - APU000074714
library(blscrapeR)
library(tidyverse)
df <- bls_api(c("APU0000704111", "APU0000706111","APU0000708111","APU0000709112"),
startyear = 2019, endyear = 2020) %>%
spread(seriesID, value) %>% dateCast() %>%
rename(chicken=APU0000706111,egg=APU0000708111,beacon=APU0000704111,milk=APU0000709112)
## REQUEST_SUCCEEDED
ggplot(data = df, aes(x = date)) +
geom_line(aes(y = chicken, color = "chicken"),size=.8) +
geom_line(aes(y = egg, color = "egg"),size=.8) +
geom_line(aes(y = beacon, color = "beacon"),size=.8) +
geom_line(aes(y = milk, color = "milk"),size=.8) +
labs(title = "Food Prices During COVID19 Pandemic", y="Price", x="Date") +
theme(legend.position="top", plot.title = element_text(hjust = 0.5))