I am scraping hotel reviews from the following TripAdvisor page:
library(rvest)
web <- read_html("https://www.tripadvisor.es/Hotel_Review-g187507-d228530-Reviews-Melia_Maria_Pita-La_Coruna_Province_of_A_Coruna_Galicia.html")
I want to get the rating dates in order to express the number of Reviews per week, but I am not able to express the date in the appropiate format. I tried the following, but it gives me
[1] NA NA NA NA NA
dateComment<-web%>%
html_nodes(".location-review-review-list-parts-EventDate__event_date--1epHa")%>%
html_attr("title")
I have also tried with html_text which gives me the date in written format. However, when I tried to express it as date format it gives me error: do not know how to convert 'df$fechaComentarios' to class “Date”
dateComment<-web%>%
html_nodes(".location-review-review-list-parts-EventDate__event_date--1epHa")%>%html_text()
df$dateComment=gsub("de","",df$dateComment)
df$date <- as.Date(df$fechaComentarios, format = "%d %B %Y")
Thank you in advance!