3
$\begingroup$

readHTMLTable seems pretty robust, but when I try to use it on this page, I get an error.

Any ideas what it means or how I could get around it? The page's biggest table is nested inside another table... is that a problem?

> tables<-readHTMLTable(myURL, header=NA,a.data.frame=TRUE)
Error in htmlParse(doc) : 
  error in creating parser for http://www.ncbi.nlm.nih.gov/genomes/lproks.cgi
$\endgroup$
2
  • 3
    $\begingroup$ Move to StackOverflow? $\endgroup$
    – kmm
    Feb 10, 2011 at 16:23
  • 1
    $\begingroup$ I think it is Ok to answer this question here. We do have a R tag. $\endgroup$
    – suncoolsu
    Feb 10, 2011 at 16:58

1 Answer 1

4
$\begingroup$

The table in question seems to need use of a Javascript button to download. If you just want this particular data then save it as the offered untitle.txt or something else (it is basically tab-delimited) and then

tables           <- read.delim("untitle.txt", skip=1)
colnames(tables) <- c(colnames(tables)[-1],"junk")
tables$junk      <- NULL

seems to give you what I believe you want. The second and third lines of the R code are to deal with "## Columns:" which starts the second line of the file and upsets read.delim() when trying to get the column names.

$\endgroup$
1
  • $\begingroup$ wow thanks - that was it - i hadn't even considered the possibility :) $\endgroup$
    – shigeta
    Feb 12, 2011 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.