Making use of vintage data

Data vintages are necessary when assessing the real-time performance of data analytics. Whether this may be to back-test a model or to look at whether a historical decision was the correct one, having the information that was available at the time, is essential.

EconData has been designed in order to make this kind of analysis possible. In this tutorial we will cover how to access the various vintages of GDP and how to construct a real-time time series of GDP growth.

As per usual we start by loading the necessary packages. If this is your first time using the EconData R package, you can find the installation instructions here.

Please note that the recent update to the new EconDataR package will affect this code, we will update the code soon.


Next, we create a helper function that converts the output of the EconData R package to dplyr tibble format.

format_gdp <- function(x) {
  as.yearqtr <- function(y)
    paste0(format(y, format = "%Y"), quarters(y))
  tibble(Value = x$KBP6006.R.S$OBS_VALUE) %>%
    mutate(Date = x$KBP6006.R.S %>%
           rownames() %>%
           as.Date() %>%
           as.yearqtr()) %>%
  mutate(Vintage = release$Description)

We then return all the vintages/releases of GDP from EconData. As usual, more information on the read_release function can be found by typing ?read_release in the R console.

releases <- read_release(id = "NATL_ACC",
                         agencyid = "ECONDATA",
                         version = "all",
                         provideragencyid = "ECONDATA",
                         providerid = "STATSSA")

This code contains a nested list. The parent list contains each of the versions of the StatsSA data - there is a version for each base year of GDP. For each version/base year there is a child list detailing the releases for that version. We will loop over both of these lists in order to extract all the releases. As we iterate through the loop we will request the data for that release from EconData and compile the results into a tibble using our previously defined helper function.

for (dataset in releases) {
  for(release in dataset$Releases) {
    natl_acc <- read_econdata(agencyid = "ECONDATA",
                              id = "NATL_ACC",
                              version = dataset$DataSet$Flowref[[3]],
                              key = "KBP6006.R.S",
                              provideragencyid = "ECONDATA",
                              providerid = "STATSSA",
                              releasedescription = release$Description)
    gdp_vintages <- rbind(gdp_vintages, format_gdp(natl_acc))

Finally, we pivot the data into columns and save the result as a CSV.

write_csv(gdp_vintages %>%
          arrange(Vintage, Date) %>%
          pivot_wider(id_cols = everything(),
                      names_from = Vintage,
                      values_from = Value),
          "Realtime GDP.csv")

As usual all the code in this blog post can be found on Github along with the code for the previous posts. We hope that you found this slightly more advanced tutorial useful and that you get value from EconData's vintage data.

The Codera Analytics team

Leave a Reply 145

Your email address will not be published. Required fields are marked *

Nice post. I learn something new and challengig on blogs I stumbleupon every day.
It’s always useful to read through articles from other writers and
practice something from other sites.

Hi there just wanted to give you a brief
heads up and let you know a few of the pictures aren’t loading properly.
I’m not sure whhy but I think its a linking issue.
I’ve tried it in two different web browsers and both show the same outcome.

Greetings!Very useful advice within this post!
It’s the little changes which will make the largest changes.
Many thhanks for sharing!

Thank you forr some other excellent article. The place else maay just anybody get
thaqt kind of information iin such a perfect approach of writing?
I have a presentation subsesquent week, annd I am at the look for such

Your style is unique in comparison to other folks I have read stuff from.
Thsnk you for posting when you’ve got the opportunity, Guess I’ll just
bookmark this web site.

Hi would you mind letting me know which web host you’re using?
I’ve loaded your blog in 3 different internet browsers and I must say this blog loads a
lot faster then most. Can yoou recommend a good web hosting provider at a honest price?
Thanks, I appreciate it!

Hello There. I found your blog using msn. This is a very smartly wrritten article.
I’ll make sure to bookmark it and come back to learn more of your
helpful information. Thank you for the post. I’ll definitely comeback.

I don’t even know hhow I ended up here, but I thought this
post was great. I do not know who you are but definitely yyou aree going to a
famous blogger if you are not already 😉 Cheers!

This design is incredible! You most certainly know how tto keep a reader entertained.

Between your wwit and your videos, I was almost moved to
start my own blog (well, almost…HaHa!) Excellent job.
I really loved what you had to say, and morte than that, how you presented it.
Too cool!



I believe wat you said made a bunch off sense.
But, what about this? wha if you were to write a killer headline?
I mean, I don’t want to tell youu how to run your blog, but what if you added a post title that makes
people desire more? I mean Making use of vintage data – EconData is kinda plain. You ought to peek at Yahoo’s front page and watch how they create
post headlines to grab viewers to open the links. You might add a vkdeo or a related picture or two to grab readers interested about what
you’ve written. In my opinion, it might make your posts a little livelier.

Wonerful blog! Do yoou have any tips and hints for aspiring writers?

I’m planning to start my own site soon but I’m a little
lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many
choices out there tht I’m totally confused .. Any ideas?

Hello! I just wanted to ask if you ever have any trouble with hackers?
My last blog (wordpress) was hacked and I ended up losing several weeks of hard work
due to no backup. Do you have any methods to stop hackers?

Someboldy essentially lend a hand to make seriously articles I migbt
state. That is the very first time I frequented your website
page and too this point? I surprissed ith the analysis you made to make this actual publish amazing.
Fantastic process!



I’m truly enjoying the design and layout of
your blog. It’s a verry easy on the eyes which maoes it much more pleasant for me to
come here and visit more often. Did you hire out a desxigner to create your theme?
Excelolent work!

Hey there, You’ve done an incredible job. I will certainly
digg it and personally suggest to my friends. I’m confident
they’ll be benefited from thos site.



Good post. I learn something new and challenging on blogs I stumbleuppn on a
daily basis. It will always bbe exciting to read through content
from other authors and use a little something from their websites.

My spouse and I stumbled over here coming from a different website and
thought I might as well check things out. I like what I see so nnow i’m following
you. Look forard tto checking out your web page again.

Simply wish tto saay your article iss as amazing. Thee cleadness in your post is simply nice and
i could assume you’re an expert on this subject.
Weell with your permission let me to grab your feed to keep updated with forrthcoming post.
Thhanks a millioin and please keep up the enjoyable work.

Thee other day, while I was at work, myy sister stole my iPad and tested to see if it can survive a 25 foot
drop, just so sshe ccan be a youtube sensation. My apple ipad is now destroyed and she
has 83 views. I know thbis is totally off topic bbut I had to
share it with someone!



escellent post, very informative. I’m wondering why the opposite
specialiusts of this sector do not notice this. You must continue your writing.

I am sure, you have a huge readers’ base already!

Gresate article. Keep posting sch kind of info on your page.

Im really impressed by your site.
Hi there, You have performed an incredible job.
I will definitely digg it and personally suggest to my friends.
I’m confident they will be benefited from this site.

I do believe all of the ideas you have presented
for your post. They’re very convincing and can certainly work.

Still, tthe posts are too quick for newbies. Could you please
prolong them a little from subsequent time? Thanks for the post.

I blog frequently and I seriously appreciate your information. Your article
has truly peaked my interest. I will book mark your site and keep checking for new information about once
peer week. I opted in ffor your Feed as well.

Good day very nicee site!! Guy .. Excellent ..
Superb .. I’ll bookmark your website and take the feeds additionally?

I’m glad to seek ouut numerous helpful info here within the publish, we want develop extra techuniques on this regard, thanks foor sharing.
. . . . .

Every weekend i used to pay a quick visit this website, forr the reason that
i wish for enjoyment, since this this web page conations truly good funny material too.

Its lkke you ead my thoughts! You seem to grasp so much about this, like you wrote the ebook in it or
something. I feel that you just could do with some percent
to pressure the messahe house a bit, however oher than that,
this is great blog. An exceloent read. I’ll deffinitely be back.



I don’t know whether it’s juist me or if perhaps everyone else
encountering problems with your blog. It lookis like some off the
written text within your posats are running off the screen. Can someone else pleas comment
and let me know if this is happening too them as well?

This might be a issue wih my internet browser because
I’ve had this happpen previously. Many thanks

Thanks for your personal marvelous posting!
I certainly enjoyed reading it, you willl be a great author.I will be sure to bookmark your blog
and definitely will come back very soon. I want
to encourage you to definitely continue your grerat work,
have a nice morning!

Hi, I do think this is a great website. I stumbledupon it 😉 I will revisit yet again since I book-marked
it. Money and freedom is the best way to change, may
you be riich and continue to help others.

I am really loving the theme/designof your site.
Do you ever run into any internet browser compatibility issues?
A number of my blog readers have complained about my website
nnot operating correctly in Explorr but looks great in Safari.
Do you have any solutions to help fix this issue?

Hi are using WordPress for your blog platform? I’m new to
the blog world but I’m trying to get started and create mmy own.
Do you need any html codig expertise to make your own blog?
Any help would be greatly appreciated!



This is very interesting, You’re a very skilled blogger.
I hage joined your rrss feed and look forward to seeking more oof your great post.

Also, I have shared your website in my social networks!

What’s Taking place i am new to this, I stumbled upon this I’ve
discoverred It absoluteely helpful and it
has helped me out loads. I hope to give a contribution & help other customers
like its helped me. Great job.

Asking questions are truly fastidious thing if you are not understanding something entirely,
however this piece of writing offers good understanding yet.

Hey there! I’m at work surfing around your bloog from my neew aple iphone!
Just wanted to say I love reading our blog and look forward to all your posts!
Carry on the excellent work!



You really make it seem so easy with your presentation but I find this topic to
be actually something that I thuink I would never understand.
It seems too complex and very broad for me. I’m looking forward for your next
post, I’ll try to get the hang of it!

You can certainly see yur skills in tthe article you write.
The world hopes forr eveen more passionate writers such as you who aren’t afraid to say
hoow they believe. Alwways follow your heart.



Hi there! I just wanted to ask iif you ever have any
problems with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no back up.

Do you have any methods to protect against hackers?

My developer is trying to convince me to move to .net from PHP.
I have always disliked tthe idea because of the costs. But
he’s tryiong none the less. I’ve been using Movable-type on a variety
of websites for about a year and am anxious about
switching to another platform. I have heard
great things about Is there a way I caan transfer alll my wordpress content into it?

Any kind of help would be greatly appreciated!

Attractive section of content. I just stumbled uon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
Any way I’ll be subscribing to yourr augment and even I achievement you access consistently rapidly.

Wonderful blog you have here buut I was wanting to know
if youu knew of any messag boards that cover thhe same topics talked about in this article?

I’d really like to be a part of communnity where I can get responses
from other experienced individuals that share the same interest.
If you have any recommendations, please let me know.

Many thanks!



Pretty section of content. I simply stumbled upon your blog
and iin accession capital to assert that I
acquire in fact enjoyed account your bloog posts.
Anyway I’ll be subscribing for your augment or even I fulfillment you get admission to consistently rapidly.



Hello! Do you use Twitter?I’d like to follow you
iif tbat would be ok. I’m absolutely enjoying your blog aand look
forward to new updates.

Have you ever thought about publishing an ebook orr guest authoring on other
websites? I have a blog based on the same ideas you discuss and would really like to have
you share some stories/information. I know my vioewers would value your
work. If you’re even remotely interested, feel free to sed me an email.

Hello! I could have sworn I’ve been to this site befote
but after browsing through many of the articles I
realized it’s new to me. Regardless, I’m certainly delighted I discovered it and I’ll be bookmarking itt
and checking back regularly!

Howdy I am so thrilled I found your site, I really found you by error, while I
was researching on Yahoo for somethiong
else,Anyhow I am here now and would just like to say cheers for a remarkable post and
a all round exciting bloig (I also lopve the theme/design), I don’t
have time to read through it all at the moment but I have sved it
and alsoo added your RSS feeds, so when I have time I will be back to read a lot more,
Please do keep up the awesome work.

Wonderful post however , I was wanting to know if you could write a
litte more on this subject? I’d be very grateful if you could
elaborate a little bit further. Kudos!



Hi there, I found your bloog by the use of Google at thhe same time as searching
for a similar matter, your weeb site came up, it appears to be like good.

I’ve bookmarked it in my google bookmarks.
Hello there, simply wwas alert to your blog through Google, and found
that it’s really informative. I’m going to be carreful for brussels.
I will be grateful if you happen to continue this in future.
Lotts of other people shall be benefited from your writing.

Justt wat to say your article is as surprising. The clearness in your post is just nice
and i could assume you’re an expert on thjs subject.
Well with your permission let me to grtab your feed too kerep up to date with forthcoming post.
Thanks a million and please carry on the gratifying work.

Hi! I juust want to give you a huge thumbs up foor your excellent info
you have here on this post. I am coming back to your website for more soon.

I aam sure this paragraph has touched all the internet users, its really really nice piece of writing on building up
neww website.

You really make it appear really easy together with your
presentation however I in finding this topic to be really one thing which I think I would by nno means understand.

It seems too complex and very broad for me. I’m looking forward in your newxt put up,
I will attfempt to get the hang of it!

Hi! This post couldn’t be writtenn anny better!

Reading thbis post reminds mme of my good olld room mate!
He always kept talking about this. I will forward thuis
write-up to him. Fairly certain he will have a good read.
Thanks for sharing!

Hi! Thhis is kind of off topic but I need some advfice from an esstablished blog.
Is iit tough to set up your own blog? I’m not very techincal but I can figvure things out pretty fast.
I’m thinking about creating my own but I’m not sure where to start.
Do you have any points or suggestions? Thanks

Hi to every one, the contents existing aat this web site
are genuinely awesome for people knowledge, well, keep up the nice work fellows.



you are in reality a just rignt webmaster. The web site loading pace
is incredible. It kind of feels that you’re doing any distinctive trick.
Moreover, The contents are masterwork. you’ve performed a magnificent jobb on this topic!

Every weekend i used to pay a visit this web page, as i want enjoyment,
as this this wweb site conations truly nice funny data too.

I know this if off opic but I’m looking into starting my own weblog and was wondering what all is required to get setup?
I’m assuming having a blog lik yours would cost a
pretty penny? I’m not very web smaart so I’m not 100% certain. Any suggestions or advice would be greatly appreciated.

This design is incredible! You most certainly know how to keeep a reader
amused. Between your wit and your videos, I was
almost oved to start my own blog (well, almost…HaHa!) Fantastic job.
I really enjoyed what you had to say, and more than that, how you presented it.
Too cool!

I really like your blog.. ver nice colors & theme.
Did you make this website yourself or did you hire someone to do it for you?
Plz reply as I’m looking to design my ownn blog and
would like to know where u got his from. thanks



I’m very pleased to discover this page. I want to to thank you for ojes time forr this particularly wonderful read!!
I definitely loved every part of it and i also have yyou
bookmarked to see new stuff on your blog.

I blog quite often and I really thawnk you for your content.
The artyicle has truly peaked my interest.

I’m going to bookmark your website and keerp checking for new
information about once a week. I opted in for your RSS feed too.



The other day, while I was at work, my sister stole my apple ipad and tested to see if it can surviv a 40 foot drop,
just so she can be a youtube sensation. My iPad is now brokeen and she hhas
83 views. I know this is tltally off topic but I had to share it with



When someone writes an piece of writing he/she retains
the idwa of a user in his/her mind that how a user can understand it.
So that’s why this paragraph is great. Thanks!

I absolutely love your website.. Pleasant colors & theme.
Did you make this web skte yourself? Please reply back as I’m wanting to create my very own website and want to learn where you got thnis from oor what the theme is
named. Kudos!

Fantastic goods from you, man. I’ve understand your
stuff previous to and you’re just extremely wonderful. I actually
like what you have obtained here, certainly like what you’re saying and
the best way in which you asdert it. You are
mking it enjoyable and you continue to take cade of to stay it
sensible.I caant wait to read much more from you. That is really
a wonderful website.

Excellent post. I wass checking continuously this blog and I am impressed!
Extremely helpful info specifically the last section :
) I hande such information much. I was looking for this certain information for a long time.
Thanks and good luck.

Hi there would you mind stating which blog platform you’re using?

I’m looking to start my own blog in the near future but I’m having a hard time choosing betweden BlogEngine/Wordpress/B2evolution and
Drupal. The reason I ask iss becayse your design seems diffrent
then most blogs and I’m looking for something completely unique.
P.S Sorry foor being off-topic but I haad to ask!

I know this iff off topic but I’m looking into starting my own weblog and
waas wonderiung what all is needed to get set up?
I’massuming having a blog like yours would cost a pretty penny?

I’m not very web savvy so I’m not 100% certain. Any recommendations or advice would be greatly appreciated.

I seriously love your site.. Great colors & theme.
Did you create this amazing site yourself? Please reply back ass I’m planning to create my veey own website and
want to learn where you got this from or what the theme
is named. Cheers!



Howdy! I know this is sort of off-topic but I had to ask.
Does managng a well-established bblog like yours take a massive amount work?
I am brand new to writing a blog but I do write
in myy diary on a daily basis. I’d like to start a blog so
I can share my personal experience and thoughts online. Please let me know if you have any kind of ideas or tips for brand new aspiring blog owners.