Raspando tabela html com extensão usando rvest
Estou usando o rvest para extrair a tabela na seguinte página:
https://en.wikipedia.org/wiki/List_of_United_States_presidential_elections_by_popular_vote_margin
O código a seguir funciona:
URL <- 'https://en.wikipedia.org/wiki/List_of_United_States_presidential_elections_by_popular_vote_margin'
table <- URL %>%
read_html %>%
html_nodes("table") %>%
.[[2]] %>%
html_table(trim=TRUE)
mas a coluna de margens e nomes de presidente tem alguns valores estranhos. O motivo é que o código fonte tem o seguinte:
<td><span style="display:none">00.001</span>−10.44%</td>
então, em vez de obter -10,44%, recebo 00,001 "10,44%
Como eu poderia consertar isso?