I am trying to combine two different data series into the same line chart with two y-axes. How could I accomplish this? The code and plots are below:
A <- ggplot(Alldata, aes(Date)) +
geom_tile(aes(alpha = Recession, y = 1), fill = "grey", height = Inf) +
scale_alpha_continuous(range = c(0, 1), breaks = c(0, 1))+
geom_line(aes(y = INFEX), col = 'blue', size = .8)+
ylab("Inflation Expectations")
B <- ggplot(Alldata, aes(Date)) +
geom_tile(aes(alpha = Recession, y = 1), fill = "grey", height = Inf) +
scale_alpha_continuous(range = c(0, 1), breaks = c(0, 1))+
geom_line(aes(y = CLI), col = 'green', size = .8)+ ylab("CLI")
A | B
ggplots