'How web scrap from this link using R?

Sunny regards from Brazil, people.

I am trying to scrap from a web page but something is going wrong. I am following this GREAT tutorial: https://youtu.be/v8Yh_4oE-Fs

and this is the page: https://transparenciamunicipios.tce.ce.gov.br/index.php/municipios/receitas/mun/002/versao/2021

What I noticed is that it has a command in the beguinning that says: loadesconde(), and "esconde" means "hide" in portuguese (link language)

Is this the problem?

thanks a lot



Solution 1:[1]

Some starting point

library(rvest)
library(purrr)

url <- 'https://transparenciamunicipios.tce.ce.gov.br/index.php/municipios/receitas/mun/002/versao/2021' 


content <- url %>%
  rvest::read_html() 


tables <- content %>% html_table(fill = TRUE)

tables |> 
  pluck(1) |> 
  janitor::clean_names()
#> # A tibble: 59 x 2
#>    receita                                                      valor_recebido_r
#>    <chr>                                                        <chr>           
#>  1 Cota-Parte do FPM - Cota Mensal - Principal                  12.422.237,17   
#>  2 Transferencias de Recursos do FUNDEB - Principal             6.324.609,86    
#>  3 Cota-Parte do ICMS - Principal                               3.765.015,28    
#>  4 Transferencias de Complementacao da Uniao ao FUNDEB - Princ. 3.359.964,56    
#>  5 Outras Transferencias da Uniao - Principal                   757.110,99      
#>  6 Incentivo Financeiro da APS - Fator Compensatorio de Transi~ 743.708,06      
#>  7 Incentivo para Acoes Estrategicas                            686.620,15      
#>  8 Cota-Parte do FPM 1% Cota dezembro - Principal               680.602,26      
#>  9 Outros Programas Fin. por Transf Fundo a Fundo - Principal   660.944,52      
#> 10 Cota- Parte do FPM 1% Cota julho - Principal                 601.208,34      
#> # ... with 49 more rows

Created on 2022-03-16 by the reprex package (v2.0.1)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bruno