thanhqtran

IMF Scraping with R

Aug 20th, 2025 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.81 KB | Source Code | 0 0
  1. library(imfr)
  2. library(tidyverse)
  3. library(stringr)
  4. library(knitr)
  5.  
  6. # See what databases are available
  7. databases <- imf_databases()
  8.  
  9. # Explore the parameters of a specific database (IFS)
  10. params_ifs <- imf_parameters(database_id = "IFS")
  11.  
  12. # Get a list of all possible code lists for the IFS database
  13. param_codelist_ifs <- imf_codelist(database_id = "IFS")
  14.  
  15. # Get all possible indicator codes for the IFS database
  16. IFS_INDICATOR_codes <- imf_codes(codelist = "CL_INDICATOR_IFS")
  17.  
  18. # Download the dataset
  19. IFS_data <- imf_dataset(database_id = "IFS",
  20.                    freq = "Q", ref_area = "VN",
  21.                    indicator = c("FPOLM_PA", "FIDR_PA", "FILR_PA","PCPI_IX","AIPMA_IX","AIP_IX","LLF_PE_NUM","LE_PE_NUM","LU_PE_NUM","LUR_PT"))
  22.  
  23. # save data
  24. write.csv(IFS_data, "path/data.csv")
Tags: IMF
Advertisement
Add Comment
Please, Sign In to add comment