Consumer Sentiment as general trends.

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"))

Retail Sales: Retail and Food Services, Total (MRTSSM44X72USS)

retail <- 
  "MRTSSM44X72USS" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") %>%
  rename(total = price) 

  retail %>% 
    ggplot(aes(x = date, y = total)) +
    geom_line(color = "goldenrod4",size=.8) + 
    labs(
      y = "Millions of Dollars",
      x = "Monthly", caption = "",
      title = "Retail Sales: Retail and Food Services, Total (MRTSSM44X72USS)",
      subtitle = str_glue("Monthly from {min(retail$date)} through {max(retail$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"))

drink <- 
  "CUSR0000SEFW" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") %>%
  rename(count = price) 

drink %>% 
    ggplot(aes(x = date, y = count)) +
    geom_line(color = "goldenrod4",size=.8) + 
    labs(
      x = "",
      y = "", caption = "Index 1982-1984=100,Seasonally Adjusted",
      title = "CPI: Alcoholic Beverages at Home (CUSR0000SEFW)",
      subtitle = str_glue("Monthly from {min(drink$date)} through {max(drink$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"))

beef <- 
  "APU0000703112" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  beef %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "gold4",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Ground Beef _ Average Retail Price",
      subtitle = str_glue("From {min(beef$date)} through {max(beef$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

pork <- 
  "APU0000FD3101" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  pork %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Pork Chop _ Average Retail Price",
      subtitle = str_glue("From {min(pork$date)} through {max(pork$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

egg <- 
  "APU0000708111" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  egg %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick2",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Eggs Grade A per Dozen _ Average Retail Price ",
      subtitle = str_glue("From {min(egg$date)} through {max(egg$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

chicken <- 
  "APU0000706111" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  chicken %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick4",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Chicken _ Retail Price Per Lb.  (Fresh and Whole) ",
      subtitle = str_glue("From {min(chicken$date)} through {max(chicken$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

milk <- 
  "APU0000709112" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  chicken %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick1",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Milk _ Retail Price Per Gallon",
      subtitle = str_glue("From {min(milk$date)} through {max(milk$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

bread <- 
  "APU0000702111" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  bread %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick2",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Bread per Lb _ Average Retail Price",
      subtitle = str_glue("From {min(bread$date)} through {max(bread$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

potatoes <- 
  "APU0000712112" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  potatoes %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick2",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Potatoes per Lb _ Average Retail Price", caption = "No data for March & April ",
      subtitle = str_glue("From {min(potatoes$date)} through {max(potatoes$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

oranges <- 
  "APU0000711311" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  oranges %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick3",size=.8) + 
    labs(
      x = "",
      y = "",
      title = "Oranges per Lb _ Average Retail Price", caption = "No data for April ",
      subtitle = str_glue("From {min(oranges$date)} through {max(oranges$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

food <- 
  "DFXARC1M027SBEA" %>% 
  tq_get(get = "economic.data", from = "2019-01-01") 

  food %>% 
    ggplot(aes(x = date, y = price)) +
    geom_line(color = "firebrick3",size=.8) + 
    labs(
      x = "Monthly",
      y = "Billions of Dollars",
      title = "Food_Personal Expenditure", caption = "",
      subtitle = str_glue("From {min(food$date)} through {max(food$date)}")
    ) +
  
     theme(plot.title = element_text(color="blue", size=14, face="bold"))

Employment during COVID19 pandemic

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"))

Total Labor Force (U6RATE)

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"))

library(blscrapeR)
## Warning: package 'blscrapeR' was built under R version 3.6.3
library(tidyverse)

tbl <- bls_api(c("LNS14000000", "LNS13327708", "LNS13327709")) %>%
    spread(seriesID, value) %>%
    dateCast() %>%
    rename(u3_unemployment = LNS14000000, u5_unemployment = LNS13327708, u6_unemployment = LNS13327709)
## REQUEST_SUCCEEDED
egg <- bls_api("APU0000708111",startyear = 2019) %>%
   spread(seriesID, value) %>% dateCast() %>%
   rename(egg=APU0000708111)
## The API requires both a start and end year.
## The endyear argument has automatically been set to 2020.
## REQUEST_SUCCEEDED
ggplot(data = tbl, aes(x = date)) + 
    geom_line(aes(y = u3_unemployment, color = "U-3 Unemployment"),size=.8) +
    geom_line(aes(y = u5_unemployment, color = "U-5 Unemployment"),size=.8) + 
    geom_line(aes(y = u6_unemployment, color = "U-6 Unemployment"),size=.8) + 
    labs(title = "Monthly Unemployment Rates", y="Percent", x="Period") +
    theme(legend.position="top", plot.title = element_text(hjust = 0.5)) 

ggplot(egg,aes(x=date))+ geom_line(aes(y=egg,color="blue"))

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)) 

BLS_Products <- read.csv(paste0("https://raw.githubusercontent.com/jzuniga123/SPS/master/",
                                "DATA%20607/BLS_Products.csv"), stringsAsFactors = F)
BLS_Products <- BLS_Products %>% filter(NAICS_SIC == "N" & HISTORIC !=1)
BLS_Products %>% select(SERIES) %>% arrange (SERIES)
##                                                                SERIES
## 1                                                 All Urban Consumers
## 2                                            American Time Use Survey
## 3                                                  Average Price Data
## 4                                             Benefits (2010 forward)
## 5                                        Business Employment Dynamics
## 6                Census of Fatal Occupational Injuries (2011 forward)
## 7                                     Chained CPI-All Urban Consumers
## 8                                     Commodity Data - Current Series
## 9                                         Consumer Expenditure Survey
## 10                                               Employment and Wages
## 11                                                 Geographic Profile
## 12                                        Import/Export Price Indexes
## 13                                     Industry Data - Current Series
## 14                                              Industry Productivity
## 15                             Job Openings and Labor Turnover Survey
## 16                                             Labor Force Statistics
## 17                                 Local Area Unemployment Statistics
## 18                              Major Sector Multifactor Productivity
## 19                                Major Sector Productivity and Costs
## 20                          Marital and Family Labor Force Statistics
## 21                                             Modeled Wage Estimates
## 22                                       National Compensation Survey
## 23                           National Employment, Hours, and Earnings
## 24        Nonfatal cases involving days away from work (2011 forward)
## 25 Occupational Injuries and Illnesses - Industry Data (2014 forward)
## 26                                   Occupational Requirements Survey
## 27                     State and Area Employment, Hours, and Earnings
## 28                              State and County Employment and Wages
## 29                                             Union Affiliation Data
## 30                            Urban Wage Earners and Clerical Workers
## 31                                                 Work Stoppage Data