Friday, December 30, 2011

Using Penn World Tables with R-Project, the easy way

Penn World Tables (PWT) is a very nice data collection on economic growth. It covers a large set of countries (from their web site):

« The Penn World Table provides purchasing power parity and national income accounts converted to international prices for 189 countries/territories for some or all of the years 1950-2009. The European Union or the OECD provide more detailed purchasing power and real product estimates for their countries and the World Bank makes current price estimates for most PWT countries at the GDP level. »

I use these data for creating graphics for my economic growth course. My workflow was based on importing them in csv format into R-Project. But I have very recently discovered that there is much better way of using them ;-) Just loading the pwt library in your R-project code, thanks to Achim Zeileis, Guan Yang who provide this library. You must first install it from CRAN, using the usual R command for this. Once it is installed, it is enough to run the following commands to gain access to the data contained in PWT 7:
You can check the names of the included variables:
And the help of the package gives you the exact definition of these variables:
If you prefer, you can use a more user-friendly name for this table:
myData <- pwt7.0
And clean the row names:
row.names(total) <- NULL
And voilà!
Simple and easy, thanks to Achim and Guan :-)


Anonymous said...

here are some useful tools to set up quickly some nice graphs with the pwt data:

yildi said...

Thanks a lot! Especially for the googleVis trick. That is very nice and useful!