I know that several people need to download data from the Eurostat website (see e.g. http://bit.ly/HrDTgT ), but what I am looking for is NOT a bulk download, but something more similar to downloading a properly formatted (small) CSV file. Consider for instance the following snippet
library(XML)
mylines <- readLines(url("http://bit.ly/1czdbRq"))
closeAllConnections()
mylist <- readHTMLTable(mylines,## stringsAsFactors = FALSE ,
asText=TRUE)
mytable <- mylist$xTable
That is already close to what I need, but there are a couple of things I cannot fix 1) the column names are lost 2) only the numerical values are left. I lose all the info about the countries the numbers refer to and the (eventual) levels/units of the statistical indicator.
Any idea about how to improve that (possibly in R)? Cheers
Lorenzo