import data

claims <- read.csv("C:/Users/Owner/Downloads/ICSA.csv")

clean the data

claims$DATE <- as.Date(claims$DATE, "%Y-%m-%d")

head(claims)
##         DATE   ICSA
## 1 1967-01-07 208000
## 2 1967-01-14 207000
## 3 1967-01-21 217000
## 4 1967-01-28 204000
## 5 1967-02-04 216000
## 6 1967-02-11 229000

plot the data

plot(claims$DATE, claims$ICSA, type = "l")

load and use ggplot and gganimate

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.6.3
library(gganimate)
## Warning: package 'gganimate' was built under R version 3.6.2
options(scipen = 10000000)
myAnim <- ggplot(claims, aes(x = DATE, y = ICSA)) + geom_line() + transition_reveal(DATE)+ view_follow()+ labs(title = "U.S. Unemployment Claims",  subtitle = "Initial Claims Seasonally Adjusted", caption = "U.S. Employment and Training Administration, Initial Claims [ICSA], \nretrieved from FRED, Federal Reserve Bank of St. Louis; https://fred.stlouisfed.org/series/ICSA, April 8, 2020.\nM.G. Barclay", x = "Date", y = "Claims") + transition_reveal(DATE) + view_follow()


myGif <- animate(myAnim, end_pause = 25)


myGif