Skip to content
Prev 332631 / 398506 Next

Download CSV Files from EUROSTAT Website

Hello,

If you want to get rid of the (bp) stuff, you can use lapply/gsub. Using 
Jean's code a bit changed,

library(XML)

mylines <- readLines(url("http://bit.ly/1coCohq"))
closeAllConnections()
mytable <- readHTMLTable(mylines, which = 2, asText=TRUE, 
stringsAsFactors = FALSE)

str(mytable)

mytable[] <- lapply(mytable, function(x) gsub("\\(.*\\)", "", x))
mytable[] <- lapply(mytable, function(x) gsub(",", "", x))
mytable[] <- lapply(mytable, as.numeric)

colnames(mytable) <- 2000:2013


Hope this helps,

Rui Barradas

Em 04-11-2013 09:53, Lorenzo Isella escreveu: