For this assignment, I asked my friends and family to give me their input on six movies. This includes a sql file, in addition to the document.
library(RMySQL)
## Loading required package: DBI
mydb = dbConnect(MySQL(), user='data607', password='data607!', dbname='moviesdb', host='localhost')
movieData <-dbGetQuery(mydb,"SELECT m.title, c.user_name, r.review, r.rating FROM movies m
INNER JOIN reviews r
ON m.id = r.v_id
INNER JOIN critics c
ON r.c_id = c.user_id;")
aggregate(rating ~ title, data = movieData, FUN=mean)
## title rating
## 1 21 Bridges 4.25
## 2 Black Panther 5.00
## 3 Joker 3.20
## 4 The Irishman 3.00
## 5 The Lion King 1.80
## 6 Toy Story 4 3.75