我正试图从他的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”
回溯:
- url%&gt;%read_html()%&gt;%html_nodes(“#REVIEWS .innerBubble”)
- withVisible(eval(quote(
_fseq
(_lhs
)),env,env))
- eval(quote(
_fseq
(_lhs
)),env,env)
- eval(quote(
_fseq
(_lhs
)),env,env)
-
_fseq
(_lhs
)
- freduce(value,
_function_list
)
- withVisible(function_list [K])
- function_list [K]
- html_nodes(。,“#REVIEWS .innerBubble”)
- html_nodes.default(。,“#REVIEWS .innerBubble”)
- xml2 :: xml_find_all(x,make_selector(css,xpath))
- xml_find_all.xml_node(x,make_selector(css,xpath))
- xpath_search(x $ node,x $ doc,xpath = xpath,nsMap = ns,num_results = Inf)
- make_selector(css,xpath)
- selectr :: css_to_xpath(css,prefix =“.//”)
- tran $ css_to_xpath(sel,pref)
- sapply(选择器,函数(选择器)selector_to_xpath(选择器,
。前缀))
- lapply(X = X,FUN = FUN,...)
- FUN(X [[i]],...)
- selector_to_xpath(选择器,前缀)
- .self $的xpath(树)
- do.call(method,list(parsed_selector))
醇>
我尝试过不用管道重写代码,安装selectr包并明确安装xml2包,但没有任何效果。我是初学者,如果我错过了一些明显的东西,请原谅我。