Contents

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 40,000 time series variables.

With the change made in CBRT API in April 1924, the “key” value is required to be added to the HTTP Request Header in web service calls. The current version of the CBRT package (0.1.1) has been adapted to the required change. Since there is no change in function parameters, the users can use the code prepared for version 0.1.0 without any modification.

The package is now available at CRAN (November 13, 2024), and can be installed by

install.packages("CBRT")

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

install.packages("http://users.metu.edu.tr/etaymaz/files/CBRT_0.1.1.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.

Finding and downloading variables

All data series (variables) are classified into data groups, and data groups into data categories. There are 44 data categories (including the archieved ones), 496 data groups, and 40,826 data series.

To find variables, use the searchCBRT function:

searchCBRT(c("production", "labor", "labour"))
##            groupCode
##               <char>
##  1:       bie_toisso
##  2:      bie_rkbigmy
##  3:     bie_tsny2010
##  4:        bie_uroto
##  5:     bie_urkisi10
##  6:     bie_ursaat10
##  7:       bie_tisguc
##  8:     bie_ysivils2
##  9:        bie_imurk
## 10:      bie_urucret
## 11:        bie_imurs
## 12:      bie_rssivil
## 13:     bie_rssivily
## 14:      bie_urimkap
## 15:      bie_ururet2
## 16:      bie_imurkkr
## 17:       bie_imurkk
## 18:       bie_imurkv
## 19:       bie_imursv
## 20:       bie_rkbigm
## 21:     bie_sivilis2
## 22:       bie_ursany
## 23:      bie_ursan97
## 24:    bie_ursanayi2
## 25:    bie_ururetim4
## 26:      bie_urur3ay
## 27:       bie_tsanay
## 28:       bie_tsny05
## 29:     bie_tsny05n2
## 30:      bie_imursur
## 31:       bie_imursu
## 32:       bie_urkisi
## 33:       bie_ursaat
## 34:     bie_altinadt
## 35:      bie_altingr
## 36:    bie_sanayrev4
## 37:      bie_uraltin
## 38:    bie_redkurigm
## 39:  bie_elektuketim
## 40:     bie_urkisi15
## 41:     bie_ursaat15
## 42:     bie_yisgucu2
## 43:   bie_isgucarsiv
## 44:   bie_sanayrev11
## 45: bie_tsanaymt2021
## 46:     bie_urkisi21
## 47:     bie_ursaat21
##            groupCode
##                                                                                                                                          groupName
##                                                                                                                                             <char>
##  1: Establishments and Labourers Covered By Collective Bargaining Strikes and Lock Outs (Ministry of Labor and Social Security) (Number) (Archive)
##  2:                                     Exchange Rates_Unit Labor Cost_Developed Countries Based Real Effective Exchange Rate (2003=100) (Archive)
##  3:                                                                       Industrial Production Index (2010=100) (TURKSTAT) (NACE REV.2) (Archive)
##  4:                                                                         OSD - Total Cars Production (AMA=Automotive Manufacturers Association)
##  5:                                             Index of Production per Person Employed (2010=100) (Ministry of Industry and Technology) (Archive)
##  6:                                                 Index of Production per Hour Worked (2010=100) (Ministry of Industry and Technology) (Archive)
##  7:                                                               Seasonally adjusted main labour force indicators (TURKSTAT)(In thousands,15+age)
##  8:                        Labour Force Status by non_Institutional Population (By the New Population Projections) (TURKSTAT) (Thousand) (Archive)
##  9:                                                  Index of Production Workers Working in Manufacturing Industry (1997=100) (TURKSTAT) (Archive)
## 10:                                                                  Payments to Production Workers in Manufacturing Industry (TURKSTAT) (Archive)
## 11:                                                     Index of Production Hours Worked In Manufacturing Industry (1997=100) (TURKSTAT) (Archive)
## 12:                                                   Non_Institutional Civilian Population by Labour Force Status (TURKSTAT) (Thousand) (Archive)
## 13:                                       Non_Institutional Civilian Population by Labour Force Status (New Series) (TURKSTAT) Thousand) (Archive)
## 14:                      Capacity Utilization Rates In the Manufacturing Industry_Weighted By Production Value ISIC REV.3 (TURKSTAT) (%) (Archive)
## 15:                       Capacity Utilization Rates In the Manufacturing Industry_Weighted By Production Value ISIC REV.3 (TURKSTAT) %) (Archive)
## 16:                                          Index of Real Earning Per Production Worker in Manufacturing Industry (1997=100) (TURKSTAT) (Archive)
## 17:                                               Index of Earning Per Production Worker in Manufacturing Industry (1997=100) (TURKSTAT) (Archive)
## 18:                                                            Index of Partial Productivity Per Production Worker (1997=100) (TURKSTAT) (Archive)
## 19:                                                       Index of Partial Productivity Per Production Hour Worked (1997=100) (TURKSTAT) (Archive)
## 20:                                             Exchange Rates_ (Previous) Unit Labor Cost Based Real Effective Exchange Rate (2003=100) (Archive)
## 21:                                      Non_Institutional Civilian Population by labour Force Status (After ABPRS) (TURKSAT) (Thousand) (Archive)
## 22:                                                                           Production Amounts of Selected Industrial Goods (TURKSTAT) (Archive)
## 23:                                                                           Production Amounts of Selected Industrial Goods (TURKSTAT) (Archive)
## 24:                                                Production of Selected Industrial Goods (TURKSTAT, SEKA=Cellulose and Paper Industry) (Archive)
## 25:                                                                                    Industrial Production Index (1992=100) (TURKSTAT) (Archive)
## 26:                                                                                    Industrial Production Index (1997=100) (TURKSTAT) (Archive)
## 27:                                                                                    Industrial Production Index (1997=100) (TURKSTAT) (Archive)
## 28:                                                                     Industrial Production Index (2005=100) (TURKSTAT) (NACE REV.1.1) (Archive)
## 29:                                                                       Industrial Production Index (2005=100) (TURKSTAT) (NACE REV.2) (Archive)
## 30:                                       Index of Real Wages Per Production Hour Worked In Manufacturing Industry (1997=100) (TURKSTAT) (Archive)
## 31:                                            Index of Wages Per Production Hour Worked In Manufacturing Industry (1997=100) (TURKSTAT) (Archive)
## 32:                                     Index of Production per Person Employed (2005=100) Ministry of Science, Industry and Technology) (Archive)
## 33:                                         Index of Production per Hour Worked (2005=100) Ministry of Science, Industry and Technology) (Archive)
## 34:                                                                                     Republican Gold Demand _ Production Amount (MINT) (Pieces)
## 35:                                                                                       Republican Gold Demand _ Production Amount (MINT) (Gram)
## 36:                                                                                    TURKSTAT - Industrial Production Index (2015=100) (Archive)
## 37:                                                                                    Gold Production of Mining Companies Declaration (BIST) (Kg)
## 38:                                                                   Exchange Rates-Unit Labor Cost Based Real Effective Exchange Rate (2003=100)
## 39:                                                                 TEIAS - Turkiye, Electricity (Production, Consumption, Exports, Imports) (MWh)
## 40:                                              Index of Production per Person Employed (2015=100)(Ministry of Industry and Technology) (Archive)
## 41:                                                  Index of Production per Hour Worked (2015=100)(Ministry of Industry and Technology) (Archive)
## 42:                                                                                   Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 43:                                                                       Basic Labour Force Indicators (TURKSTAT) (In thousands,15+age) (Archive)
## 44:                                                             TURKSTAT - Industrial Production Index - Seasonal and Calendar Adjusted (2015=100)
## 45:                                                             TURKSTAT - Industrial Production Index - Seasonal and Calendar Adjusted (2021=100)
## 46:                                                        Index of Production per Person Employed (2015=100)(Ministry of Industry and Technology)
## 47:                                                            Index of Production per Hour Worked (2015=100)(Ministry of Industry and Technology)
##                                                                                                                                          groupName
searchCBRT(c("production", "labor", "labour"), field = "series")
##              seriesCode
##                  <char>
##   1: TP.IYA.CDUR2.S08.C
##   2: TP.IYA.CNDU2.S08.C
##   3: TP.IYA.CONS2.S08.C
##   4: TP.IYA.FOBE2.S08.C
##   5: TP.IYA.INTM2.S08.C
##  ---                   
## 671:     TP.YISGUCU2.G5
## 672:     TP.YISGUCU2.G6
## 673:        TP.RS.YAA03
## 674:        TP.RS.YAA09
## 675:        TP.RS.YAA13
##                                                                                                     seriesName
##                                                                                                         <char>
##   1: 8.(SHORTAGE OF LABOUR FORCE) What main factors are currently limiting your production? (Percentage Share)
##   2: 8.(SHORTAGE OF LABOUR FORCE) What main factors are currently limiting your production? (Percentage Share)
##   3: 8.(SHORTAGE OF LABOUR FORCE) What main factors are currently limiting your production? (Percentage Share)
##   4: 8.(SHORTAGE OF LABOUR FORCE) What main factors are currently limiting your production? (Percentage Share)
##   5: 8.(SHORTAGE OF LABOUR FORCE) What main factors are currently limiting your production? (Percentage Share)
##  ---                                                                                                          
## 671:                                                                                       Not in labour force
## 672:                                                                       Labour force participation rate (%)
## 673:                                                                                    Labour force(Thousand)
## 674:                                                                       Labour force participation rate (%)
## 675:                                                                             Not in labour force(Thousand)
##         groupCode
##            <char>
##   1:    bie_cdur2
##   2:    bie_cndu2
##   3:    bie_cons2
##   4:    bie_fobe2
##   5:    bie_intm2
##  ---             
## 671: bie_yisgucu2
## 672: bie_yisgucu2
## 673: bie_ysivils2
## 674: bie_ysivils2
## 675: bie_ysivils2
##                                                                                                                    groupName
##                                                                                                                       <char>
##   1:                                                        Business Tendency Statistics-Durable Consumer Goods (NACE REV.2)
##   2:                                                    Business Tendency Statistics-Non-durable Consumer Goods (NACE REV.2)
##   3:                                                                Business Tendency Statistics-Consumer Goods (NACE REV.2)
##   4:                                                              Business Tendency Statistics-Food & Beverages (NACE REV.2)
##   5:                                                            Business Tendency Statistics-Intermediate Goods (NACE REV.2)
##  ---                                                                                                                        
## 671:                                                            Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 672:                                                            Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 673: Labour Force Status by non_Institutional Population (By the New Population Projections) (TURKSTAT) (Thousand) (Archive)
## 674: Labour Force Status by non_Institutional Population (By the New Population Projections) (TURKSTAT) (Thousand) (Archive)
## 675: Labour Force Status by non_Institutional Population (By the New Population Projections) (TURKSTAT) (Thousand) (Archive)
searchCBRT(c("production", "labor", "labour"), tags = TRUE)
##            seriesCode                            seriesName      groupCode
##                <char>                                <char>         <char>
##   1: TP.ISGUCARSIV.G1 Population 15 years and over(Archive) bie_isgucarsiv
##   2: TP.ISGUCARSIV.G2                 Labour Force(Archive) bie_isgucarsiv
##   3: TP.ISGUCARSIV.G3                     Employed(Archive) bie_isgucarsiv
##   4: TP.ISGUCARSIV.G4                   Unemployed(Archive) bie_isgucarsiv
##   5: TP.ISGUCARSIV.G5          Not in labour force(Archive) bie_isgucarsiv
##  ---                                                                      
## 413:   TP.YISGUCU2.G4                            Unemployed   bie_yisgucu2
## 414:   TP.YISGUCU2.G5                   Not in labour force   bie_yisgucu2
## 415:   TP.YISGUCU2.G6   Labour force participation rate (%)   bie_yisgucu2
## 416:   TP.YISGUCU2.G7                   Employment rate (%)   bie_yisgucu2
## 417:   TP.YISGUCU2.G8                 Unemployment rate (%)   bie_yisgucu2
##                                                                     groupName
##                                                                        <char>
##   1: Basic Labour Force Indicators (TURKSTAT) (In thousands,15+age) (Archive)
##   2: Basic Labour Force Indicators (TURKSTAT) (In thousands,15+age) (Archive)
##   3: Basic Labour Force Indicators (TURKSTAT) (In thousands,15+age) (Archive)
##   4: Basic Labour Force Indicators (TURKSTAT) (In thousands,15+age) (Archive)
##   5: Basic Labour Force Indicators (TURKSTAT) (In thousands,15+age) (Archive)
##  ---                                                                         
## 413:             Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 414:             Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 415:             Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 416:             Main labour force indicators (TURKSTAT)(In thousands,15+age)
## 417:             Main labour force indicators (TURKSTAT)(In thousands,15+age)

The package contains the lists of all data categories, data groups, and data series, as of 03 November 2024. You can update the lists by the following commands:

allCBRTCategories <- getAllCategoriesInfo()
allCBRTGroups <- getAllGroupsInfo()
allCBRTSeries <- getAllSeriesInfo()

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

showGroupInfo("bie_apifon")
##              Code
##            <char>
## 1: cid           
## 2: groupCode     
## 3: groupName     
## 4: freq          
## 5: source        
## 6: sourceLink    
## 7: revisionPolicy
##                                                                            Variable
##                                                                              <char>
## 1: 1                                                                               
## 2: bie_apifon                                                                      
## 3: CBRT Net Funding (Business, Million TRY) and Weighted Average Funding Cost of th
## 4: 2 (Work day)                                                                    
## 5: CBRT                                                                            
## 6:                                                                                 
## 7:                                                                                 
## * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
##           seriesCode                                             seriesName
##               <char>                                                 <char>
##  1:   TP.APIFON1.IHA                             A1.Funding Through Auction
##  2: TP.APIFON1.KOT.A A2a.BIST O/N Repo, Quotation Repo, Primary Dealer Repo
##  3: TP.APIFON1.KOT.B                                        A2b.TRY Deposit
##  4: TP.APIFON1.KOT.C                              A2c.LON Deposit, LON Repo
##  5: TP.APIFON1.KOT.T                         A2.Total Funding Via Quotation
##  6:   TP.APIFON1.TOP                                A.Total Funding (A1+A2)
##  7:   TP.APIFON2.IHA                       B1.Sterilization Through Auction
##  8:   TP.APIFON2.KOT                     B2.Sterilization Through Quotation
##  9:   TP.APIFON2.TOP                          B.Total Sterilization (B1+B2)
## 10:       TP.APIFON3                                 CBRT Net Funding (A-B)
## 11:       TP.APIFON4              Weighted Average Cost of the CBRT Funding
##     aggMethod
##        <char>
##  1:      last
##  2:      last
##  3:      last
##  4:      last
##  5:      last
##  6:      last
##  7:      last
##  8:      last
##  9:      last
## 10:      last
## 11:      last

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

showSeriesNames("bie_apifon")
##           seriesCode                                             seriesName
##               <char>                                                 <char>
##  1:   TP.APIFON1.IHA                             A1.Funding Through Auction
##  2: TP.APIFON1.KOT.A A2a.BIST O/N Repo, Quotation Repo, Primary Dealer Repo
##  3: TP.APIFON1.KOT.B                                        A2b.TRY Deposit
##  4: TP.APIFON1.KOT.C                              A2c.LON Deposit, LON Repo
##  5: TP.APIFON1.KOT.T                         A2.Total Funding Via Quotation
##  6:   TP.APIFON1.TOP                                A.Total Funding (A1+A2)
##  7:   TP.APIFON2.IHA                       B1.Sterilization Through Auction
##  8:   TP.APIFON2.KOT                     B2.Sterilization Through Quotation
##  9:   TP.APIFON2.TOP                          B.Total Sterilization (B1+B2)
## 10:       TP.APIFON3                                 CBRT Net Funding (A-B)
## 11:       TP.APIFON4              Weighted Average Cost of the CBRT Funding
##     aggMethod
##        <char>
##  1:      last
##  2:      last
##  3:      last
##  4:      last
##  5:      last
##  6:      last
##  7:      last
##  8:      last
##  9:      last
## 10:      last
## 11:      last

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", CBRTKey = xxxxxx)
mySeries <- getDataSeries(c("TP.D1TOP", "TP.D2HAZ", "TP.D4TCMB"), CBRTKey = xxxxxx)
mySeries <- getDataSeries(c("TP.D1TOP", "TP.D2HAZ", "TP.D4TCMB"), CBRTKey = xxxxxx,
                            startDate="01-01-2010")

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

myData <- getDataGroup("bie_dbafod")

If you create an object called myCBRTKey in R session to store your CBRT key, you do not need to define it for downloading:

myCBRTKey <- your-key

Then,

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")
myData <- getDataGroup("bie_dbafod")

You can also specify the frequency and the aggregation method for the series to be downloaded.

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.

R-Bloggers

Visit R-Bloggers site about content contributed by more than 750 bloggers who write about R.

R Weekly

Visit R Weekly site for current news on R, R packages, and R events.