Get startedGet started for free

Detecting modification effects

Now that you have new weighted star reviews for each restaurant, let's see if you can detect the effects of the modifications.

To do so, you will make use of some a general hist plot and a qplot from the ggplot2 package. These graphs will help us visualize the effect of your modification. Take note of the magnitudes of the changes and if there were any patterns in the distribution of the difference in star reviews.

A final summary of the new_review_indian will give context to how the reviews changed as well.

This exercise is part of the course

R, Yelp and the Search for Good Indian Food

View Course

Exercise instructions

  • Make ggplot2 available in the environment
  • Use hist() function and the new_review_indian$diff column to create the plot of the distribution.
  • Use geom_bar() with the new_review_indian$diff to the plot the difference in star review per restaurant. Fill in the x enlargement with the new_review_indian data set and assign the y argument within the aes() to the diff variable.
  • Display the summary of the new_review_indian data frame

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Load the ggplot2 package into the environment
library(ggplot2)

# Plot the distribution of changes to reviews 
hist(new_review_indian$___, main = "Changes in Star Reviews", xlab = "Change")

# Plot the changes in review per restaurant 
ggplot(___, aes(x=1:nrow(new_review_indian), y=___, fill=city)) +
    geom_bar(stat="identity", position=position_dodge()) + 
    theme_classic() + scale_fill_grey() + xlab("Businesses ID") + ylab("Change in Star Review")

# Display a summary of the 
summary(___)
Edit and Run Code