使用rvest包中的html_nodes时出错

时间:2018-05-01 12:04:46

标签: html r xpath rvest

我正试图从他的GitHub here运行Hadley Wickham的代码。当我运行以下代码时:

library(rvest)

url <- "http://www.tripadvisor.com/Hotel_Review-g37209-d1762915-`Reviews-JW_Marriott_Indianapolis-Indianapolis_Indiana.html"`

reviews <- url %>%
  read_html() %>%
  html_nodes("#REVIEWS .innerBubble")

我收到以下错误:

xpath_combinedselector()中的错误:找不到函数“xpath_combinedselector” 回溯:

  1. url%&gt;%read_html()%&gt;%html_nodes(“#REVIEWS .innerBubble”)
  2. withVisible(eval(quote(_fseq_lhs)),env,env))
  3. eval(quote(_fseq_lhs)),env,env)
  4. eval(quote(_fseq_lhs)),env,env)
  5. _fseq_lhs
  6. freduce(value,_function_list
  7. withVisible(function_list [K])
  8. function_list [K]
  9. html_nodes(。,“#REVIEWS .innerBubble”)
  10. html_nodes.default(。,“#REVIEWS .innerBubble”)
  11. xml2 :: xml_find_all(x,make_selector(css,xpath))
  12. xml_find_all.xml_node(x,make_selector(css,xpath))
  13. xpath_search(x $ node,x $ doc,xpath = xpath,nsMap = ns,num_results = Inf)
  14. make_selector(css,xpath)
  15. selectr :: css_to_xpath(css,prefix =“.//”)
  16. tran $ css_to_xpath(sel,pref)
  17. sapply(选择器,函数(选择器)selector_to_xpath(选择器, 。前缀))
  18. lapply(X = X,FUN = FUN,...)
  19. FUN(X [[i]],...)
  20. selector_to_xpath(选择器,前缀)
  21. .self $的xpath(树)
  22. do.call(method,list(parsed_selector))
  23. 我尝试过不用管道重写代码,安装selectr包并明确安装xml2包,但没有任何效果。我是初学者,如果我错过了一些明显的东西,请原谅我。

0 个答案:

没有答案