Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: could not find function "read_html"

Tags:

r

rvest

I use this code

library(rvest)
url<-read_html("http://en.wikipedia.org/wiki/Brazil_national_football_team")

And I take back this error

Error: could not find function "read_html"

Any idea what's going wrong with this?

Also in case of multiple links like this

library(rvest)
urls<-html("https://en.wikipedia.org/wiki/Financial_crisis",
"https://en.wikipedia.org/wiki/Inflection",
"https://en.wikipedia.org/wiki/Financial_crisis_of_2007%E2%80%9308"
)

I receive this:

 Error: is.config(config) is not TRUE

How can I make it to work? How is it if I have this links into a txt file?

like image 925
Demi Kalia Avatar asked Jun 20 '15 16:06

Demi Kalia


1 Answers

The documentation probably referred to the read_html() function in the xml2 package which is written by the same author, Hadley Wickham, after the initial publication of the rvest package.

Therefore, you will have to install and load the xml2 package as follows:

install.packages('xml2')
library('xml2')

url<-read_html("http://en.wikipedia.org/wiki/Brazil_national_football_team")
like image 117
yxtay Avatar answered Sep 22 '22 09:09

yxtay