Error: could not find function "read_html"

18,104

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")
Share:
18,104

Related videos on Youtube

Demi Kalia
Author by

Demi Kalia

Updated on June 04, 2022

Comments

  • Demi Kalia
    Demi Kalia almost 2 years

    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?

    • MrFlick
      MrFlick almost 9 years
      The function used to be called html(). You're probably using a version of rvest where that version of the function name still exists. Try html() instead.