Read HTML Table in R - Troubleshooting
I have seen a number of posts here that describe how to parse HTML tables using the XML package. That said, I have got my code to work except that my first data row gets read in as my column names.
My code is taken from the answser at this link
How can I get around this?开发者_JAVA百科
Many thanks,
Brock
From the XML package documentation for "readHTMLTable":
header: either a logical value indicating whether the table has
column labels, e.g. the first row or a ‘thead’, or
alternatively a character vector giving the names to use for
the resulting columns.
So running the same command but passing in header=FALSE
should do what you want. Alternatively, if you have a vector of column names you want to use instead, you can use header=your_vector_of_column_names
to set the column names instead of setting them to empty strings.
精彩评论