Reviews and time series

Part 4 (continues from part 3).

The top_cool reviewers category has provided their reviews over different years, approximately from 2009 to 2012. For this reason, I have created a new data set to pull out dates.

dates_reviews<- italian %>% 
  select(reviewer_name,reviewer_cool, reviewer_useful, date, business_stars, stars, business_name,business_city, text) %>% 
  filter(reviewer_cool >= 1000, reviewer_useful >= 1000,business_stars >=4, business_name== "The Parlor")
dates_reviews
(dates_reviews$date)

class(dates_reviews$date)

I have to make sure my dates are not represented as characters.

I test it.

star_dates <- c("8/17/2009", "4/19/2012", "7/1/2010", "8/21/2009", "1/31/2010", 
"6/28/2009" , "6/20/2012" , "8/13/2009" , "1/22/2011" , "10/21/2010",
"4/21/2010" , "8/24/2009" , "11/10/2009" ,"5/17/2011" , "7/16/2009" ,
"7/3/2009" ,  "8/26/2009",  "8/24/2009" , "7/9/2009" ,  "7/6/2009"  ,
"8/22/2009" , "8/3/2010" ,  "8/9/2009"  , "8/26/2009" , "8/17/2009" ,
"1/9/2010")
star_dates
class(star_dates) #this gives a character

Therefore I insert the correct format.


parlor_dates <- as.Date(star_dates,
                         format = "%m/%d/%Y")
parlor_dates
class(parlor_dates) # this returns a date
p <- ggplot(dates_reviews, aes(x= parlor_dates, y=stars)) + geom_point()
p

#Add trend smoothed line
p + stat_smooth(
  color = "#FC4E07", fill = "#FC4E07",
  method = "loess"
)
Table 1. 4 and 5 star reviews over time – The Parlor restaurant

These reviews seem quite regular over time, with some differences in 2009. Since we have only considered reviews with the highest number of stars, we could consider all the stars “The Preston” has received over time.

We create the new data set

dates_reviews_all<- italian %>% 
  select(reviewer_name,reviewer_cool, reviewer_useful, date, business_stars, stars, business_name,business_city, text) %>% 
  filter(business_name== "The Parlor")
dates_reviews_all
as_tibble(dates_reviews_all)
class(dates_reviews_all$date)

class(dates_reviews_all$date)

#create date variable

parlor_dates_allstars <- (dates_reviews_all$date)
library(ggplot2)
class(parlor_dates_allstars) #this gives a character
parlor_dates_allstars

#Therefore I insert the correct format.

Years <- as.Date(parlor_dates_allstars,format = "%m/%d/%Y")
class(Years)                      

#Now our dates are in order and class is date.

ggplot(data = dates_reviews_all, aes(x = Years, y = stars)) + 
  geom_line(color = "#FC4E07", size = 0.5)
Table 2. Trends of star reviews – all stars not only 4 and 5- over time for the Parlor.

Most reviews are positive until 2013, and if we check actual reviews, they are even better. The low-star reviews are not very common. This graphic seems consistent with the previous one in table 1. To discover whether this analysis is actual, I suggest checking the actual reviews of that restaurant, which have a very positive trends that confirm the results obtained in this analysis. Anyway, in case I visit Phoenix, this restaurant will be my pick!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s