开发者

Read HTML Table in R - Troubleshooting

开发者 https://www.devze.com 2023-01-16 08:33 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号