Skip to content
Prev 392517 / 398502 Next

html into R

Sorry, there's simpler code. I used html_elements (plural) and the 
result is a list. Use html_element (singular) and the output is a tibble.


page |>
   html_element("table") |>
   html_table(header = TRUE) |>
   (\(x) {
     hdr <- unlist(x[3, ])
     y <- x[-(1:3), ]
     names(y) <- hdr
     y
   })()


Hope this helps,

Rui Barradas

?s 11:53 de 26/08/2022, Rui Barradas escreveu: