I am new to R and am currently working on an assignment dealing with web scraping.
I am supposed to read in all the sentences from this web page: https://www.cs.columbia.edu/~hgs/audio/harvard.html
This is my current code:
library(xml2)
library(rvest)
url <- 'https://www.cs.columbia.edu/~hgs/audio/harvard.html'
read_html(url)
sentences <- url %>%
html_nodes("li") %>%
html_text()
And everytime I run it, I get this error:
Error in UseMethod("xml_find_all") : no applicable method for 'xml_find_all' applied to an object of class "character"
Can you please help me? I don't understand what I'm doing wrong.