Skip to content

Instantly share code, notes, and snippets.

@danielvartan
Last active February 22, 2025 19:04
Show Gist options
  • Save danielvartan/020140db3674f1595970e4b533542dda to your computer and use it in GitHub Desktop.
Save danielvartan/020140db3674f1595970e4b533542dda to your computer and use it in GitHub Desktop.
Parse HTML tables using `rvest`
# library(clipr)
# library(prettycheck) # github.com/danielvartan/prettycheck
# library(rvest)
parse_html_table <- function(x = clipr::read_clip()) {
prettycheck:::assert_character(x)
x |>
paste0(collapse = " ") |>
rvest::read_html() |>
rvest::html_element("table") |>
rvest::html_table()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment