Cannot autocomplete rvest::html_read()


#1

rvest tells me html() is deprecated and that I should use read_html() instead. Why doesn’t it show up as a suggestion when writing rvest::read_html()?


#2

It is because read_html is a function of xml2 not rvest.

When you call library(rvest), the xml2 package is also loaded, so read_html can be called directly. However, it lives for sure in xml2 and when you want to use this function with :: namespace syntax, you should call it from where it lives, xml2::read_html

Several issues on that in rvest github. I have updated the last one to point to them all and gives answer.


#3

Thanks for the good advice. I should have read the error message more closely :sweat_smile:

rvest::html()
Error in xml2::read_html(x, ..., encoding = encoding) : 
  argument "x" is missing, with no default
In addition: Warning message:
'rvest::html' is deprecated.
Use 'read_html' instead.
See help("Deprecated")