我尝试使用几乎一个空元素删除HTML表中的行,使用XLM包中的readHTMLTable()函数表示(NULL)但没有成功。在我的代码中:
require(httr)
require(XML)
readFE<- function (x, URL = ""){
FILE <- GET(url=URL)
tables <- getNodeSet(htmlParse(FILE), "//table")
FE_tab <- readHTMLTable(tables[[1]],
header = c("empresa","desc_projeto","desc_regiao",
"cadastrador_por","cod_talhao","descricao",
"formiga_area","qtd_destruido","latitude",
"longitude","data_cadastro"),
colClasses = c("character","character","character",
"character","character","character",
"character","character","character",
"character","character"),
trim = TRUE, stringsAsFactors = FALSE
)
x<-NULL
results <- x
x<-FE_tab[-(1),]
results <- x
results
}
tableFE<-readFE(URL="https://www.dropbox.com/s/mb316ghr4irxipr/TALHOES_AGENTES.htm?dl=1")
tableFE
有人可以帮助我吗?
谢谢,
亚历山大