I am in very unfamiliar terrain with downloading this file set from the Federal Reserve's website (I was hoping for an API but it doesn't appear to exist).
I am not sure what this Fed link format really is and how I would read the data into R.
I tried solutions here and here but I get different errors and not sure where to go. When I try something like this solution:
library(XML)
tf <- tempfile(tmpdir = tdir <- tempdir())
## Download the zip file
download.file("https://www.federalreserve.gov/datadownload/Output.aspx?rel=Z1&filetype=zip", tf)
## Unzip it in the temp folder
xml_files <- unzip(tf, exdir = tdir)
## Parse the first file
doc <- xmlInternalTreeParse(xml_files[1])
I get Warning message: In unzip(tf, exdir = tdir) : zip file is corrupt
So basically, I would like to be able to get the data without having to first go to the website, download the excel version, and then read the excel version into R.
I am assuming there is a way to just reference this link https://www.federalreserve.gov/datadownload/Output.aspx?rel=Z1&filetype=zip to read the data into R without the manual steps associated with first downloading in excel.
The link for different download options for this data is here: https://www.federalreserve.gov/datadownload/Choose.aspx?rel=Z1
Thanks!