簡體   English   中英

無法從R中的XML庫重現第一個示例

[英]Cannot reproduce the first example from XML library in R

當我跑步時:

example(readHTMLTable)

我收到以下錯誤:

Error: failed to load HTTP resource

庫XML已安裝並正在運行。 這是我的會話信息:

> sessionInfo()
 R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] reshape2_1.4  ggplot2_1.0.0 XML_3.98-1.1  dplyr_0.2    

loaded via a namespace (and not attached):
 [1] assertthat_0.1   colorspace_1.2-4 digest_0.6.4     grid_3.1.1       gtable_0.1.2    
 [6] magrittr_1.0.1   MASS_7.3-33      munsell_0.4.2    parallel_3.1.1   plyr_1.8.1      
[11] proto_0.3-10     Rcpp_0.11.2      scales_0.2.4     stringr_0.6.2    tools_3.1.1    

我需要安裝其他庫嗎?

當該錯誤發生時,加載httr軟件包並調用它。 這是我自己的工作中的一個示例,其中第一個XML調用返回了錯誤,但httr調用未返回:

require(httr)

doc <- htmlTreeParse('http://www.lewisthomason.com/locations/', useInternal = TRUE)
doc <- content(GET('http://www.lewisthomason.com/locations/'))

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM