An R API providing easy access to a relational database with macroeconomic, financial and development related time series data for Uganda. Overall more than 5000 series at varying frequency (daily, monthly, quarterly, annual in fiscal or calendar years) can be accessed through the API. The data is provided by the Bank of Uganda, the Ugandan Ministry of Finance, Planning and Economic Development, the IMF and the World Bank. The database is being updated once a month.
package
Functions
Functions to retrieve tables identifying the data
datasources()
datasets()
series()
Function to retrieve the data from the database
get_data()
Functions to reshape data and add temporal identifiers
long2wide()
wide2long()
expand_date()
Function to export wide format data to Excel
wide2excel()
Helper functions (useful esp. for common Excel formats)
make_date()
transpose_wide()
Global Macros with core ID variables in the database
.IDvars
.Tvars
Function to renew database connection without reloading the package
ugatsdb_reconnect()
Examples
library(ugatsdb)library(magrittr)# Pipe %>% operatorslibrary(xts)# Time series class and pretty plots# Plotting daily IFEM Buying and Selling Rates from the Bank of Ugandaget_data("BOU_E", c("E_IFEM_B","E_IFEM_S"), from =2020)%>% as.xts %>% plot
library(dygraphs)# Same generating a dynamic chartget_data("BOU_E", c("E_IFEM_B","E_IFEM_S"), from =2020)%>% as.xts %>% dygraph
# Static plot but with legend showing variable labelsget_data("BOU_E", c("E_IFEM_B","E_IFEM_S"), from =2020, wide =FALSE)%>% long2wide(names_from ="Label")%>% as.xts %>% plot(legend.loc ="topleft")