Skip to contents

parse_html_table() parses a HTML table to a tibble.

Usage

parse_html_table(x = clipr::read_clip())

Arguments

x

(optional) A character vector with HTML code.

Value

A tibble with the parsed HTML table.

Examples

x <- c(
  "<table>",
  "  <tr>",
  "    <th>Name</th>",
  "    <th>Age</th>",
  "  </tr>",
  "  <tr>",
  "    <td>Alice</td>",
  "    <td>30</td>",
  "  </tr>",
  "  <tr>",
  "    <td>Bob</td>",
  "    <td>25</td>",
  "  </tr>",
  "</table>"
)

x |> parse_html_table()
#> # A tibble: 2 × 2
#>   Name    Age
#>   <chr> <int>
#> 1 Alice    30
#> 2 Bob      25