Web scrapping with R, java or html? [closed]

0

How do I extract the data table from the following page: link

    
asked by anonymous 03.01.2017 / 19:25

1 answer

2

Take a look at the rvest package.

The page you want was actually built using bad practices, which makes the job a bit difficult. By analyzing the code of the page, you can find out that the content is in fact at link

Then, the following code captures the content of the page:

library(rvest)
tb = read_html("http://www.ons.org.br/resultados_operacao/boletim_semanal/2016_12_16/ena_arquivos/sheet001.htm") %>% 
  html_node("table") %>% 
  html_table(fill = TRUE)

Then you use subsetting to get just what matters, and put some proper names in the columns.

tb = tb[6:9, 2:4]
colnames(tb) = c("Região", "M/W Médios", "% MLT")
    
03.01.2017 / 23:39