Hello All, i was trying to simply run the readHTMLTable on the example published in the package. And on a page I was working on. So running: u = "http://en.wikipedia.org/wiki/List_of_countries_by_population" tables = readHTMLTable(u) returns the following error: Error in tb[["thead"]] : subscript out of bounds looking up this error on the web, didnt give me any hint. Is something wrong with this function? this is my sessioninfo:> sessionInfo()R version 2.14.1 (2011-12-22) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] XML_3.9-4.1 RCurl_1.91-1.1 bitops_1.0-4.1 PerformanceAnalytics_1.0.3.2 [5] quantstrat_0.6.4 blotter_0.8.4 FinancialInstrument_0.13.6 quantmod_0.3-17 [9] Defaults_1.1-1 TTR_0.21-0 xts_0.8-2 zoo_1.7-6 loaded via a namespace (and not attached): [1] grid_2.14.1 IBrokers_0.9-3 lattice_0.20-0 tools_2.14.1 Many thanks Sven -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-readHTMLTable-tp4631439.html Sent from the R help mailing list archive at Nabble.com.
Hi Sven, The function is working perfectly fine for me.? Could it be due to package masking the function?? Sometimes, these problems will get solved by restarting R console.? It happened to me a couple of times. A.K. ----- Original Message ----- From: Sven D <sduve at hotmail.com> To: r-help at r-project.org Cc: Sent: Saturday, May 26, 2012 10:17 AM Subject: [R] Problem with readHTMLTable Hello All, i was trying to simply run the readHTMLTable on the example published in the package. And on a page I was working on. So running: u = "http://en.wikipedia.org/wiki/List_of_countries_by_population" tables = readHTMLTable(u) returns the following error: Error in tb[["thead"]] : subscript out of bounds looking up this error on the web, didnt give me any hint. Is something wrong with this function? this is my sessioninfo:> sessionInfo()R version 2.14.1 (2011-12-22) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United Kingdom.1252? LC_CTYPE=English_United Kingdom.1252? ? LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C? ? ? ? ? ? ? ? ? ? ? ? ? ? LC_TIME=English_United Kingdom.1252? ? attached base packages: [1] stats? ? graphics? grDevices utils? ? datasets? methods? base? ? other attached packages: [1] XML_3.9-4.1? ? ? ? ? ? ? ? ? RCurl_1.91-1.1? ? ? ? ? ? ? bitops_1.0-4.1? ? ? ? ? ? ? PerformanceAnalytics_1.0.3.2 [5] quantstrat_0.6.4? ? ? ? ? ? blotter_0.8.4? ? ? ? ? ? ? FinancialInstrument_0.13.6? quantmod_0.3-17? ? ? ? ? ? [9] Defaults_1.1-1? ? ? ? ? ? ? TTR_0.21-0? ? ? ? ? ? ? ? ? xts_0.8-2? ? ? ? ? ? ? ? ? zoo_1.7-6? ? ? ? ? ? ? ? ? loaded via a namespace (and not attached): [1] grid_2.14.1? ? IBrokers_0.9-3 lattice_0.20-0 tools_2.14.1? Many thanks Sven -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-readHTMLTable-tp4631439.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.
Odd... it doesn't throw an error for me. Two things possibly come to mind, but I don't know enough of the XML internals to know if they're reasonable. First is that something seems funny about your version number -- mine is simply XML_3.9-4 (no added "-1"); do you have any idea why yours would be different? Could you reinstall the package with Prof Ripley's build (I believe the regular install.packages() route should work after you uninstall with remove.packages()) and see if that fixes it? It could also possibly be an encoding/locale issue but that seems less likely. Hope this gets you going in the right direction, Michael On Sat, May 26, 2012 at 10:17 AM, Sven D <sduve at hotmail.com> wrote:> Hello All, > > i was trying to simply run the readHTMLTable on the example published in the > package. And on a page I was working on. So running: > > u = "http://en.wikipedia.org/wiki/List_of_countries_by_population" > tables = readHTMLTable(u) > > returns the following error: > > Error in tb[["thead"]] : subscript out of bounds > > > looking up this error on the web, didnt give me any hint. Is something wrong > with this function? > > > this is my sessioninfo: > >> sessionInfo() > R version 2.14.1 (2011-12-22) > Platform: i386-pc-mingw32/i386 (32-bit) > > locale: > [1] LC_COLLATE=English_United Kingdom.1252 ?LC_CTYPE=English_United > Kingdom.1252 ? ?LC_MONETARY=English_United Kingdom.1252 > [4] LC_NUMERIC=C ? ? ? ? ? ? ? ? ? ? ? ? ? ?LC_TIME=English_United > Kingdom.1252 > > attached base packages: > [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base > > other attached packages: > ?[1] XML_3.9-4.1 ? ? ? ? ? ? ? ? ?RCurl_1.91-1.1 > bitops_1.0-4.1 ? ? ? ? ? ? ? PerformanceAnalytics_1.0.3.2 > ?[5] quantstrat_0.6.4 ? ? ? ? ? ? blotter_0.8.4 > FinancialInstrument_0.13.6 ? quantmod_0.3-17 > ?[9] Defaults_1.1-1 ? ? ? ? ? ? ? TTR_0.21-0 ? ? ? ? ? ? ? ? ? xts_0.8-2 > zoo_1.7-6 > > loaded via a namespace (and not attached): > [1] grid_2.14.1 ? ?IBrokers_0.9-3 lattice_0.20-0 tools_2.14.1 > > Many thanks > > > > Sven > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Problem-with-readHTMLTable-tp4631439.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.
Thanks Michael, thanks Arun, silly enough, I actually had to restart the whole thing. And the function now performs pretty well. Many thanks Sven -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-readHTMLTable-tp4631439p4631498.html Sent from the R help mailing list archive at Nabble.com.