The purpose of statbanktools is to provide a set of helper functions to accompany the statbanker package. statbanktools eases the task of extracting data from CSO tables and generates interactive charts that show the data in levels, differences, and growth rates. The series are stored as an S4 object, which contains the raw data, the transformations of the data, and metadata.
You can install the development version of statbanktools from GitHub with:
# install.packages("pak")
pak::pak("xprimexinverse/statbanktools")This is a basic example which shows you how to solve a common problem:
library(statbanker)
library(plotly)
#> Loading required package: ggplot2
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
library(statbanktools)
NAQ01 <- getStatBankData("NAQ01", type = "px")
#> *** METADATA ***
#> CSO Table = NAQ01
#> TITLE = Expenditure on GNP and Percentage change on Expenditure on GNP at Constant Market Prices - Sectors and Quarter 1995Q1 - 2024Q2
#> UNITS = Euro Million
#> SOURCE = Central Statistics Office, Ireland
#> DATABASE =
#> CREATION DATE =
#> LAST UPDATED = 20240905 11:00
#> FILE ADDRESS = https://ws.cso.ie/public/api.restful/PxStat.Data.Cube_API.ReadDataset/NAQ01/PX/2013/
PCR_SA <- get_series(NAQ01, index = 2)
PCR_SA@data
#> level Q-on-Q Y-on-Y Q-diff Y-diff
#> 1995 Q1 11661 NA NA NA NA
#> 1995 Q2 11990 2.821370380 NA 329 NA
#> 1995 Q3 12288 2.485404504 NA 298 NA
#> 1995 Q4 12489 1.635742188 NA 201 NA
#> 1996 Q1 12656 1.337176716 8.53271589 167 995
#> 1996 Q2 12805 1.177307206 6.79733111 149 815
#> 1996 Q3 13048 1.897696212 6.18489583 243 760
#> 1996 Q4 13328 2.145922747 6.71791176 280 839
#> 1997 Q1 13425 0.727791116 6.07616941 97 769
#> 1997 Q2 13695 2.011173184 6.95041000 270 890
#> 1997 Q3 13963 1.956918583 7.01256898 268 915
#> 1997 Q4 14564 4.304232615 9.27370948 601 1236
#> 1998 Q1 14653 0.611095853 9.14711359 89 1228
#> 1998 Q2 15030 2.572851976 9.74808324 377 1335
#> 1998 Q3 15275 1.630073187 9.39626155 245 1312
#> 1998 Q4 15463 1.230769231 6.17275474 188 899
#> 1999 Q1 16052 3.809092673 9.54753293 589 1399
#> 1999 Q2 16053 0.006229753 6.80638723 1 1023
#> 1999 Q3 17023 6.042484271 11.44353519 970 1748
#> 1999 Q4 17012 -0.064618457 10.01746104 -11 1549
#> 2000 Q1 17846 4.902421820 11.17617742 834 1794
#> 2000 Q2 18272 2.387089544 13.82296144 426 2219
#> 2000 Q3 18398 0.689579685 8.07730717 126 1375
#> 2000 Q4 18575 0.962061094 9.18763226 177 1563
#> 2001 Q1 18919 1.851951548 6.01255183 344 1073
#> 2001 Q2 19305 2.040276970 5.65345884 386 1033
#> 2001 Q3 19291 -0.072520073 4.85378846 -14 893
#> 2001 Q4 19687 2.052770722 5.98654105 396 1112
#> 2002 Q1 19886 1.010819322 5.11126381 199 967
#> 2002 Q2 19971 0.427436387 3.44988345 85 666
#> 2002 Q3 20473 2.513644785 6.12720958 502 1182
#> 2002 Q4 20443 -0.146534460 3.84009753 -30 756
#> 2003 Q1 20687 1.193562589 4.02795937 244 801
#> 2003 Q2 20842 0.749262822 4.36132392 155 871
#> 2003 Q3 20927 0.407830343 2.21755483 85 454
#> 2003 Q4 21182 1.218521527 3.61492932 255 739
#> 2004 Q1 21558 1.775092059 4.21037366 376 871
#> 2004 Q2 21688 0.603024399 4.05911141 130 846
#> 2004 Q3 21888 0.922168941 4.59215368 200 961
#> 2004 Q4 22106 0.995979532 4.36219432 218 924
#> 2005 Q1 22471 1.651135438 4.23508674 365 913
#> 2005 Q2 23089 2.750211384 6.45979343 618 1401
#> 2005 Q3 23851 3.300272857 8.96838450 762 1963
#> 2005 Q4 24002 0.633097145 8.57685696 151 1896
#> 2006 Q1 24125 0.512457295 7.36059810 123 1654
#> 2006 Q2 24737 2.536787565 7.13759799 612 1648
#> 2006 Q3 24923 0.751910094 4.49457046 186 1072
#> 2006 Q4 25419 1.990129599 5.90367469 496 1417
#> 2007 Q1 26095 2.659427987 8.16580311 676 1970
#> 2007 Q2 26317 0.850737689 6.38719327 222 1580
#> 2007 Q3 26599 1.071550709 6.72471211 282 1676
#> 2007 Q4 26856 0.966201737 5.65325150 257 1437
#> 2008 Q1 27257 1.493148645 4.45296034 401 1162
#> 2008 Q2 26623 -2.326007998 1.16274651 -634 306
#> 2008 Q3 26745 0.458250385 0.54889282 122 146
#> 2008 Q4 26616 -0.482333146 -0.89365505 -129 -240
#> 2009 Q1 25915 -2.633754133 -4.92350589 -701 -1342
#> 2009 Q2 25746 -0.652131970 -3.29414416 -169 -877
#> 2009 Q3 25581 -0.640876253 -4.35221537 -165 -1164
#> 2009 Q4 25638 0.222821625 -3.67448151 57 -978
#> 2010 Q1 25782 0.561666277 -0.51321628 144 -133
#> 2010 Q2 25909 0.492591731 0.63310806 127 163
#> 2010 Q3 26065 0.602107376 1.89202924 156 484
#> 2010 Q4 25839 -0.867063111 0.78399251 -226 201
#> 2011 Q1 25772 -0.259297960 -0.03878675 -67 -10
#> 2011 Q2 25675 -0.376377464 -0.90316106 -97 -234
#> 2011 Q3 25243 -1.682570594 -3.15365433 -432 -822
#> 2011 Q4 25422 0.709107475 -1.61383954 179 -417
#> 2012 Q1 25109 -1.231217056 -2.57255937 -313 -663
#> 2012 Q2 25251 0.565534271 -1.65141188 142 -424
#> 2012 Q3 25600 1.382123480 1.41425346 349 357
#> 2012 Q4 25540 -0.234375000 0.46416490 -60 118
#> 2013 Q1 25176 -1.425215348 0.26683659 -364 67
#> 2013 Q2 25182 0.023832221 -0.27325650 6 -69
#> 2013 Q3 25381 0.790247002 -0.85546875 199 -219
#> 2013 Q4 25551 0.669792364 0.04306969 170 11
#> 2014 Q1 25451 -0.391374115 1.09231014 -100 275
#> 2014 Q2 25786 1.316254764 2.39853864 335 604
#> 2014 Q3 25891 0.407197704 2.00937709 105 510
#> 2014 Q4 26340 1.734193349 3.08794176 449 789
#> 2015 Q1 26128 -0.804859529 2.66001336 -212 677
#> 2015 Q2 26535 1.557715860 2.90467696 407 749
#> 2015 Q3 26881 1.303938195 3.82372253 346 990
#> 2015 Q4 26967 0.319928574 2.38041002 86 627
#> 2016 Q1 27673 2.618014610 5.91319657 706 1545
#> 2016 Q2 27477 -0.708271600 3.55002826 -196 942
#> 2016 Q3 27551 0.269316155 2.49246680 74 670
#> 2016 Q4 28059 1.843853218 4.04939370 508 1092
#> 2017 Q1 28292 0.830393100 2.23683735 233 619
#> 2017 Q2 28247 -0.159055563 2.80234378 -45 770
#> 2017 Q3 28742 1.752398485 4.32289209 495 1191
#> 2017 Q4 28974 0.807181129 3.26098578 232 915
#> 2018 Q1 29707 2.529854352 5.00141383 733 1415
#> 2018 Q2 30071 1.225300434 6.45732290 364 1824
#> 2018 Q3 30139 0.226131489 4.86048292 68 1397
#> 2018 Q4 30340 0.666909984 4.71457168 201 1366
#> 2019 Q1 30758 1.377719183 3.53788669 418 1051
#> 2019 Q2 31030 0.884322778 3.18911908 272 959
#> 2019 Q3 30813 -0.699323236 2.23630512 -217 674
#> 2019 Q4 31009 0.636095155 2.20500989 196 669
#> 2020 Q1 29422 -5.117869006 -4.34358541 -1587 -1336
#> 2020 Q2 25312 -13.969138740 -18.42732839 -4110 -5718
#> 2020 Q3 28749 13.578539823 -6.69847142 3437 -2064
#> 2020 Q4 28213 -1.864412675 -9.01673708 -536 -2796
#> 2021 Q1 26712 -5.320242441 -9.21079464 -1501 -2710
#> 2021 Q2 30793 15.277777778 21.65376106 4081 5481
#> 2021 Q3 31820 3.335173578 10.68211068 1027 3071
#> 2021 Q4 32058 0.747957260 13.62846915 238 3845
#> 2022 Q1 32273 0.670659430 20.81835879 215 5561
#> 2022 Q2 33644 4.248133114 9.25859773 1371 2851
#> 2022 Q3 34146 1.492093687 7.30986801 502 2326
#> 2022 Q4 34552 1.189011890 7.77964939 406 2494
#> 2023 Q1 34845 0.847997222 7.96951012 293 2572
#> 2023 Q2 35750 2.597216243 6.25965997 905 2106
#> 2023 Q3 34779 -2.716083916 1.85380425 -971 633
#> 2023 Q4 35822 2.998936140 3.67561936 1043 1270
#> 2024 Q1 35829 0.019541064 2.82393457 7 984
#> 2024 Q2 36229 1.116414078 1.33986014 400 479