Giter Site home page Giter Site logo

cbrt's Introduction

The package

The CBRT package includes functions for finding, and downloading data from the Central Bank of the Republic of Turkey's database.

The CBRT database covers more than 22,000 time series variables.

You can install the package from the source by using the following command (the CBRT package depends on the data.table package.):

install.packages("http://users.metu.edu.tr/etaymaz/files/CBRT_0.1.0.tar.gz",
                 repos = NULL, type = "source")

You may also install it from GitHub. Install the the devtools package if not installed, then

library(devtools)
install_github("etaymaz/CBRT")

Please kindly note that you need a key to download data from the CBRT's database. To get the key, register at the CBRT's Electronic Data Delivery System. Registration is free of charge and takes only a few minutes.

If you create an object called myCBRTkey in R session, you do not need to define it for downloading:

myCBRTKey <- your-key

Finding and downloading variables

All data series (variables) are classified into data groups, and data groups into data categories. There are 24 data categories (including the archieved ones), 323 data groups, and 22,243 data series.

To find variables, use the searchCBRT function:

searchCBRT(c("production", "labor", "labour"))
searchCBRT(c("production", "labor", "labour"), field = "series")
searchCBRT(c("production", "labor", "labour"), tags = TRUE)

The package contains the lists of all data categories, data groups, and data series, as of 26 January 2019. You can update the lists by the following commands:

allCBRTCategories <- getAllCategories()
allCBRTGroups <- getAllGroups()
allCBRTSeries <- getAllSeries()

After identifying the data group or data series, you can get some information about the data by showGroupInfo function:

showGroupInfo("bie_apifon")

If you want to get only names of series in a data group, use the following command:

showSeriesNames("bie_apifon")

You can download either one or more data series you specified, or all data series in a data group.

To download individual data series, use the getDataSeries function:

mySeries <- getDataSeries("TP.D1TOP")
mySeries <- getDataSeries(c("TP.D1TOP", "TP.D2HAZ", "TP.D4TCMB"))
mySeries <- getDataSeries(c("TP.D1TOP", "TP.D2HAZ", "TP.D4TCMB", startDate="01-01-2010"))

To download all data series in a group, use the getDataGroup function:

myData <- getDataGroup("bie_dbafod")

The freq parameter defines the frequency of the data. If you do not define any frequency, the default frequency will be used.

The aggType paremeter defines the method to be used to aggregate data series from high frequency to low frequency (for example, weekly data to monthly data). If no aggregation method is defined, the default will be used. (For the default values, use the showGroupInfo function.)

For example, if you define monthly frequency for weekly data, and "sum" as the aggregation method, then the monthly totals will be returned. Since a data group includes more than one series, the getDataGroup function does not have any aggType parameter, and it aggregates data series by using their default aggregation method.

The following frequencies are defined (from high frequency to low frequency):

  • 1 Day
  • 2 Work day
  • 3 Week
  • 4 Biweekly
  • 5 Month
  • 6 Quarter
  • 7 Six months
  • 8 Year

The following aggregation methods are available:

  • avg Average value
  • first First observation
  • last Last observation
  • max Maximum value
  • min Minimum value
  • sum Sum

The myData object is in data.table and data.frame classes, and it includes a time variable, and data series. The time variable will be either in date or numeric format depending on its frequency.

Comments and suggestions

I would appreciate your comments, suggestions, and bug reports. Please contact me by e-mail.

cbrt's People

Contributors

etaymaz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.