Search code examples
rhtml-tablervest

read the table in html format with R


I use rvest::read_html to read the table in html format. The html file is just a table. here is my code.

library(rvest)

pp = read_html("Batch1_Parameters.html") %>%
  html_table()

pptable = pp[[1]]

I could get the table by these code. but is there any method to read the table with only one sentence?


Solution

  • Your code is simple already, I dont see any solution simplier than it but you can check this if it is needed one pipe

    library(rvest)
    
    pptable <- read_html("Batch1_Parameters.html") %>%
      html_table() %>%
      .[[1]]