[R] How to suppress errors generated by readHTMLTable?

Duncan Temple Lang duncan at wald.ucdavis.edu
Fri Nov 27 00:29:22 CET 2009


Just this morning, I made suppressing these parser messages
the default behavior for htmlParse() and that will apply
to readHTMLTable() also.

Until I release that (along with another potentially
non-backward compatible change regarding character encoding),
you can use

 readHTMLTable(htmlParse("index.html", error = function(...){}))

i.e. parse the document yourself and hand it to readHTMLTable().

 D.

Peng Yu wrote:
> library(XML)
> 
> download.file('http://polya.umdnj.edu/polya_db2/gene.php?llid=109079&unigene=&submit=Submit','index.html')
> tables=readHTMLTable("index.html",error=function(...){})
> tables
> 
> 
> readHTMLTable gives me the following errors. Could somebody let me
> know how to suppress them?
> 
> 
> Opening and ending tag mismatch: center and table
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> Opening and ending tag mismatch: td and tr
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> htmlParseEntityRef: expecting ';'
> Unexpected end tag : form
> Opening and ending tag mismatch: body and center
> Opening and ending tag mismatch: body and center
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list