Movie Popularity as Decided by My Friends

Introduction: The goal of this assignment is to have my friends rate 6 different recent movie titles on a scale of 1-5. 1 being the most enjoyable movie, 5 being the least, and 0 (or null) being haven’t seen. The movies I have chosen are:

Star Wars Rouge One

The Big Sick

Wonder Woman

Get Out

Moonlight

Arrival

Step 1: load package

library(RMySQL)
## Loading required package: DBI

Step 2: establish a connection with MySQL

db <- dbConnect (MySQL(), user='root', password='root', dbname='homework 2', host='localhost')

check to see if the connection is made

films <- dbGetQuery(db, "SELECT * FROM movieranks")
summary (films)
##   firstname            starwars        bigsick       wonderwoman 
##  Length:8           Min.   :0.000   Min.   :0.000   Min.   :0.0  
##  Class :character   1st Qu.:2.000   1st Qu.:0.000   1st Qu.:0.0  
##  Mode  :character   Median :2.500   Median :0.000   Median :1.0  
##                     Mean   :2.375   Mean   :0.625   Mean   :1.5  
##                     3rd Qu.:3.000   3rd Qu.:1.250   3rd Qu.:3.0  
##                     Max.   :4.000   Max.   :2.000   Max.   :4.0  
##      getout       moonlight       arrival     
##  Min.   :0.00   Min.   :0.00   Min.   :0.000  
##  1st Qu.:0.75   1st Qu.:0.75   1st Qu.:3.000  
##  Median :1.00   Median :1.00   Median :3.000  
##  Mean   :1.25   Mean   :1.50   Mean   :3.125  
##  3rd Qu.:2.00   3rd Qu.:2.00   3rd Qu.:4.000  
##  Max.   :3.00   Max.   :5.00   Max.   :5.000

basic data exploration

ratings <- subset(films, select= c("starwars", "bigsick", "wonderwoman", "getout", "moonlight", "arrival"))
ratings
##   starwars bigsick wonderwoman getout moonlight arrival
## 1        3       2           0      2         2       4
## 2        4       0           0      3         5       5
## 3        2       1           0      1         0       3
## 4        2       0           3      1         1       3
## 5        2       0           2      1         1       3
## 6        0       2           0      0         1       0
## 7        3       0           3      0         0       4
## 8        3       0           4      2         2       3