ECODATA is an R package for downloading and visualizing economic data
Can pull data from FRED and World Bank
Create reproducible, professional-quality data visualizations, and documenting your data sources
Easy only two or three lines of code
Download data on average 30-year mortgage interest rate from FRED:
ECODATA data frame mydata
:
Get a description of the data
Variable | Code | Description | Frequency | Units | Seasonal Adjustment | Source | URL | Access Date |
---|---|---|---|---|---|---|---|---|
30-Year Fixed Rate Mortgage Average in the United States | MORTGAGE30US | 30-Year Fixed Rate Mortgage Average in the United States | Weekly | % | Not Seasonally Adjusted | FRED (R) Federal Reserve Bank of St. Louis | February 03, 2025 |
Cite the data
Variable | Cite |
---|---|
30-Year Fixed Rate Mortgage Average in the United States | FRED (R) Federal Reserve Bank of St. Louis; https://fred.stlouisfed.org/series/MORTGAGE30US; Accessed on February 03, 2025. |
Reproducible: The code is the set of instructions for what you created
Flexible: With more knowledge of R, you can change the data, the graph, the labels, etc.
Efficient: Easy to replicate code for similar variables, similar tasks
Used in other courses: R is used in econometrics (ECO 307), statistics (STAT courses), and others
Coding in R and Python used in industry, even among those who are not computer scientists or data scientists
Even more important / relevant with AI
AI assistance makes coding more accessible
Verification and reproducibility is key with AI-generated content
# Get three variables - Save the list of URLs in an objected called 'variables'
variables <- c("https://fred.stlouisfed.org/series/FEDFUNDS",
"https://fred.stlouisfed.org/series/UNRATE",
"https://fred.stlouisfed.org/series/CPIAUCSL")
# Make up my own names for those variables
varnames <- c("Federal Funds Rate", "Unemployment Rate", "CPI")
# Download all three variables, give them my own names
# Also set frequency = "m" for monthly data
mydata <- get_ecodata(variables, varnames = varnames, frequency = "m")
# Get only Great Recession + Recovery
mydata <- mydata |>
filter(Date >= "2007-01-01" & Date <= "2016-12-31")
ECODATA data frame mydata
: