我在这里看过很多帖子,描述了如何使用XML包解析HTML表。也就是说,我已经让我的代码工作,除了我的第一个数据行作为我的列名读入。
我的代码来自this link
的回答者我怎样才能解决这个问题?
非常感谢,
布洛克
答案 0 :(得分:3)
来自“readHTMLTable”的XML包文档:
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.
所以运行相同的命令,但传入header=FALSE
应该做你想要的。或者,如果您想要使用列名称向量,则可以使用header=your_vector_of_column_names
设置列名,而不是将其设置为空字符串。