How to filter out nodes with rvest?
问题 I am using the R rvest library to read an html page containing tables. Unfortunately the tables have inconsistent number of columns. Here is an example of the table I read: <table> <tr class="alt"> <td>1</td> <td>2</td> <td class="hidden">3</td> </tr> <tr class="tr0 close notule"> <td colspan="9">4</td> </tr> </table> and my code to read the table in R: require(rvest) url = "table.html" x <- read_html(url) (x %>% html_nodes("table")) %>% html_table(fill=T) # [[1]] # X1 X2 X3 X4 X5 X6 X7 X8 X9