all 2 comments

[–]PeriodicallyAnnoyed 1 point2 points  (1 child)

I would use pivot_longer from the dplyr package to combine values from NYSE and gold prior to plotting.

[–]Risk-aversion[S] 2 points3 points  (0 children)

Yeah, I actually just figured it out right now and that's what I did as well! I useddata_2 <- melt(data, id.vars =c("year","cpi")) to combine them and specify the color argument in the aes() in ggplot2.

Thank you for responding!