Introduction

This R Markdown document will read a movie rating dataset and calculate basic summary statistic for the movie ratings.

Read the dataset

# Load the readr package 
library(readr)
## Warning: package 'readr' was built under R version 4.4.3
# Read the movie_ratings.csv file
movies <- read_csv("movie_ratings.csv")
## Rows: 520 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (6): Const, Title, URL, Title Type, Genres, Directors
## dbl  (5): Your Rating, IMDb Rating, Runtime (mins), Year, Num Votes
## date (2): Date Rated, Release Date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# Display the dataset
movies
## # A tibble: 520 × 13
##    Const      `Your Rating` `Date Rated` Title  URL   `Title Type` `IMDb Rating`
##    <chr>              <dbl> <date>       <chr>  <chr> <chr>                <dbl>
##  1 tt10062338             7 2022-08-12   Earwig http… movie                  5.4
##  2 tt10095582             6 2022-01-22   The T… http… movie                  7.1
##  3 tt10095856            10 2019-04-17   Ramms… http… musicVideo             9.2
##  4 tt1014759              5 2018-08-03   Alice… http… movie                  6.4
##  5 tt1017460              6 2018-07-30   Splice http… movie                  5.8
##  6 tt1020530              6 2018-08-03   Eden … http… movie                  6.7
##  7 tt0102510              8 2022-11-10   The N… http… movie                  6.9
##  8 tt10272534            10 2020-11-24   Lvx Æ… http… movie                  6.3
##  9 tt1028532              7 2018-07-30   Hachi… http… movie                  8.1
## 10 tt1032846              7 2018-08-06   4 lun… http… movie                  7.9
## # ℹ 510 more rows
## # ℹ 6 more variables: `Runtime (mins)` <dbl>, Year <dbl>, Genres <chr>,
## #   `Num Votes` <dbl>, `Release Date` <date>, Directors <chr>
# Check the number of rows and columns 
dim(movies)
## [1] 520  13
# Display names of the variables 
names(movies)
##  [1] "Const"          "Your Rating"    "Date Rated"     "Title"         
##  [5] "URL"            "Title Type"     "IMDb Rating"    "Runtime (mins)"
##  [9] "Year"           "Genres"         "Num Votes"      "Release Date"  
## [13] "Directors"
# Generate summary statistics for dataset
summary(movies)
##     Const            Your Rating      Date Rated            Title          
##  Length:520         Min.   : 1.00   Min.   :2018-07-25   Length:520        
##  Class :character   1st Qu.: 6.00   1st Qu.:2018-08-03   Class :character  
##  Mode  :character   Median : 7.00   Median :2018-08-18   Mode  :character  
##                     Mean   : 6.79   Mean   :2019-10-19                     
##                     3rd Qu.: 8.00   3rd Qu.:2021-04-17                     
##                     Max.   :10.00   Max.   :2023-01-17                     
##                                                                            
##      URL             Title Type         IMDb Rating    Runtime (mins) 
##  Length:520         Length:520         Min.   :2.500   Min.   :  4.0  
##  Class :character   Class :character   1st Qu.:5.700   1st Qu.: 89.0  
##  Mode  :character   Mode  :character   Median :6.500   Median :100.0  
##                                        Mean   :6.461   Mean   :103.3  
##                                        3rd Qu.:7.300   3rd Qu.:117.0  
##                                        Max.   :9.200   Max.   :201.0  
##                                                        NA's   :3      
##       Year         Genres            Num Votes        Release Date       
##  Min.   :1948   Length:520         Min.   :     32   Min.   :1948-08-23  
##  1st Qu.:2008   Class :character   1st Qu.:   5054   1st Qu.:2008-07-01  
##  Median :2014   Mode  :character   Median :  73810   Median :2013-12-17  
##  Mean   :2011                      Mean   : 216092   Mean   :2011-09-17  
##  3rd Qu.:2018                      3rd Qu.: 261012   3rd Qu.:2018-04-22  
##  Max.   :2022                      Max.   :2660102   Max.   :2022-10-25  
##                                                                          
##   Directors        
##  Length:520        
##  Class :character  
##  Mode  :character  
##                    
##                    
##                    
## 
# Calculate the mean IMDb rating
mean(movies$`IMDb Rating`, na.rm = TRUE)
## [1] 6.461346
# Calculate the median IMDb rating
median(movies$`IMDb Rating`, na.rm = TRUE)
## [1] 6.5
# Find the minimum IMDb rating
min(movies$`IMDb Rating`, na.rm = TRUE)
## [1] 2.5
# Find the maximum IMDb rating
max(movies$`IMDb Rating`, na.rm = TRUE)
## [1] 9.2
# Calculate the standard deviation of IMDb ratings
sd(movies$`IMDb Rating`, na.rm = TRUE)
## [1] 1.197407

Distribution of IMDb Ratings

# Create a histogram showing the distribution of IMDb ratings
hist(movies$`IMDb Rating`, main = "Distribution of IMDb Ratings", xlab = "IMDb Rating")

Figure 1.Distribution of IMDb Ratings: The histogram shows that most movies in the dataset have IMDb ratings between 5.5 and 7.5. The distribution centers around 6.5, consistent with the mean of 6.46 and the median of 6.5.

Conclusion

The movies in this dataset show that IMDb ratings are predominantly centered on 6.5, with a mean of 6.46 and a median of 6.5. The ratings vary between 2.5 and 9.2, with a standard deviation of about 1.20. The majority of films, according to the histogram, have scores between 5.5 and 7.5. The distribution of IMDb ratings in this dataset is therefore clearly illustrated.