Final Project: Independent Data Intensive Research
ETR537
Author
Eric Krzak
Published
Invalid Date
Overview
As a final project, you’ll be applying the knowledge and skills gained throughout this semester to conduct the independent analysis. Similar to the case studies provided in this course, your analysis should demonstrate your ability to wrangle, analyze, and communicate findings in response to a research question of interest. You will also be expected to use Quarto to create a reproducible data product, which contains all the code used during each step of your analysis so it can be reproduced by others.
Your data product should demonstrate your ability to formulate clear, actionable research questions relevant to a targeted audience. Specifically, your data product should include an introduction that:
Clearly describes the purpose of your data product, including the research question(s) guiding your analyses.
I wanted to look at some different types of data sets than we have examined in our class activities. Our case study had focused on educational data, so I wanted to pick something that was unrelated to education. I found a trending data set on Kraggle with Netflix data from 2021. Some of the questions I considered exploring in this project were:
Is there a trend in the type of content available in different countries?
What insights can be gleamed by analyzing the actors and directors for the movies and shows?
Has the type of content changed over time?
Provides information about the data sources, including the context in which the data was collected and variables used to address your research questions.
This data was pulled from Netflix’s API. There are several variables reported such as the type of media, title, people involved, country where the media is available, the date added to Netflix, the date produced, the rating, duration of the show, the tags, and the description of the show. For my analysis, I would be interested in comparing the duration of the tv shows to the other variables to see if there was any correlation between the longevity of a show and the people involved or the rating. I should also be able to see how the type of content has changed by conparing the date added variable to things like the media type, tags, and tv rating. One variable I wish was present, but isn’t, would be the number of streams. This could be a good way to compare popularity to actors and tv shows.
Wrangle
Your data project should demonstrate your ability to use R to manipulate, clean, transform, and/or merging data in order to prepare your text for analysis. Specifically, your data product should clearly describe:
Data preprocessing steps (e.g., renaming variables, filtering, tokenization, stemming, stop words removal, etc.) taken to clean and prepare your text for analysis and why are they necessary, as well as any steps will excluded and why.
The first step is usually to install the tidyverse package which includes many helpful packages like the plotting packages. I also installed the skimr and dyplyr packages since we used those a lot in class.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.3 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.3 ✔ tibble 3.2.1
✔ lubridate 1.9.2 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(skimr)library(dplyr)
I went through and renamed a few variables to make them more intuitive. For example, the whole data set is called Netflix titles, but titles is just one variable in the data set. I renamed it Netflix_Data to be more descriptive. I also changed listed_in to genre to better describe the data.
Rows: 8807 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (11): show_id, type, title, director, cast, country, date_added, rating,...
dbl (1): release_year
ℹ 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.
I then wanted to view the data. This could help identify how the variables are characterized. I found out that the duration of the show was listed as chr type variable. I thought it might be more helpful to have it be a dbl variable so I could plot it on scatter plots. I also thought it might be helpful to separate the duration variable into number_of_seasons and movie_length, so that I am not getting movie duration plots that are crowded out by all the tv shows with small numbers of seasons.
head(Netflix_Data)
# A tibble: 6 × 12
show_id type title director cast country date_added release_year rating
<chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <chr>
1 s1 Movie Dick Jo… Kirsten… <NA> United… September… 2020 PG-13
2 s2 TV Show Blood &… <NA> Ama … South … September… 2021 TV-MA
3 s3 TV Show Ganglan… Julien … Sami… <NA> September… 2021 TV-MA
4 s4 TV Show Jailbir… <NA> <NA> <NA> September… 2021 TV-MA
5 s5 TV Show Kota Fa… <NA> Mayu… India September… 2021 TV-MA
6 s6 TV Show Midnigh… Mike Fl… Kate… <NA> September… 2021 TV-MA
# ℹ 3 more variables: duration <chr>, genres <chr>, description <chr>
library(stringr)
I had to filter out all the rows that contained the string “min” to get a table with just the movie durations. Then I seperated that column to isolate the numerical values from the units. Then I could change the variable type from chr to dbl. All this needed to be done so that the numerical values could be plotted on scatter plots and similar graphics.
# A tibble: 6,128 × 2
show_id duration
<chr> <chr>
1 s1 90 min
2 s7 91 min
3 s8 125 min
4 s10 104 min
5 s13 127 min
6 s14 91 min
7 s17 67 min
8 s19 94 min
9 s23 161 min
10 s24 61 min
# ℹ 6,118 more rows
# A tibble: 6,128 × 3
show_id duration_min duration_units
<chr> <dbl> <chr>
1 s1 90 min
2 s7 91 min
3 s8 125 min
4 s10 104 min
5 s13 127 min
6 s14 91 min
7 s17 67 min
8 s19 94 min
9 s23 161 min
10 s24 61 min
# ℹ 6,118 more rows
I will repeat this same process to isolate the number of seasons for the tv shows.
# A tibble: 2,676 × 3
show_id number_seasons duration_units
<chr> <dbl> <chr>
1 s2 2 Seasons
2 s3 1 Season
3 s4 1 Season
4 s5 2 Seasons
5 s6 1 Season
6 s9 9 Seasons
7 s11 1 Season
8 s12 1 Season
9 s15 1 Season
10 s16 4 Seasons
# ℹ 2,666 more rows
This code made a seperate row for each actor and each genre tag so that data could be more easily examined by looking at individual actors and actresses rather then groups of cast members, and I could examine individual drama instead of combinations of dramas. I am going to have to be careful to use the unseperated list if I want to examine things like number of tv shows with 2 seasons, because the numbers or rows may be inflated due to a large cast, or a large number of genres.
I also wanted to see what kind of data I could get from skimming the program. I needed to load the skimr and dplyr package first. Skimming the data this way confirmed that there were a lot of rows that had incomplete data. I would need to make sure the program was ignoring all the N/A’s when doing data analysis.
skim(Netflix_Data)
Data summary
Name
Netflix_Data
Number of rows
8807
Number of columns
12
_______________________
Column type frequency:
character
11
numeric
1
________________________
Group variables
None
Variable type: character
skim_variable
n_missing
complete_rate
min
max
empty
n_unique
whitespace
show_id
0
1.00
2
5
0
8807
0
type
0
1.00
5
7
0
2
0
title
0
1.00
1
104
0
8807
0
director
2634
0.70
2
208
0
4528
0
cast
825
0.91
3
771
0
7692
0
country
831
0.91
4
123
0
748
0
date_added
10
1.00
11
18
0
1714
0
rating
4
1.00
1
8
0
17
0
duration
3
1.00
5
10
0
220
0
genres
0
1.00
6
79
0
514
0
description
0
1.00
61
248
0
8775
0
Variable type: numeric
skim_variable
n_missing
complete_rate
mean
sd
p0
p25
p50
p75
p100
hist
release_year
0
1
2014.18
8.82
1925
2013
2017
2019
2021
▁▁▁▁▇
Any new variables or features you created to address your research questions; or any data transformations you made required for the types of analyses or packages used (e.g. reshaping, merging, joining etc.).
I also wanted to separate a couple variables to make sure that each variable had its own column. I wanted to separate the date added to 3 columns based on the month, day, and year added.
I believe that making new columns for the number of seasons and the movie duration from above might count for this kind of data transformation. I need to rejoin the tv_duration to the Netflix_Data table. I actually needed to go back and make sure the select function picked duration and the show_id, so that the full_join function had a common column to match.
Netflix_Data <- Netflix_Data |>full_join(tv_duration, by ="show_id") |>full_join(movie_duration, by ="show_id")
Analyze
Your data project should demonstrate your ability to use R to apply text mining techniques appropriate to your research questions and data sources. Specifically, your data product should clearly include:
I used the summary function and skim function to look at a general analysis of the different variables. There are several descriptive statistics that stand out. The oldest movie added was originally released in 1925, and the most recent was 2021, which makes sense because the data set was last updated 2 years ago. The median movie release year was 2017, which shows that Netflix typically updates more modern movies. It can also be seen that 69.05% of media are movies and the other 30.95% are tv shows. We can also see that the average show lasts about 2 seasons (1.7) and the average movie lasts about 99 minutes.
summary(Netflix_Data)
show_id type title director
Length:8807 Length:8807 Length:8807 Length:8807
Class :character Class :character Class :character Class :character
Mode :character Mode :character Mode :character Mode :character
cast country month_added day_added
Length:8807 Length:8807 Length:8807 Length:8807
Class :character Class :character Class :character Class :character
Mode :character Mode :character Mode :character Mode :character
year_added release_year rating duration
Length:8807 Min. :1925 Length:8807 Length:8807
Class :character 1st Qu.:2013 Class :character Class :character
Mode :character Median :2017 Mode :character Mode :character
Mean :2014
3rd Qu.:2019
Max. :2021
genres description number_seasons duration_units.x
Length:8807 Length:8807 Length:8807 Length:8807
Class :character Class :character Class :character Class :character
Mode :character Mode :character Mode :character Mode :character
duration_min duration_units.y
Length:8807 Length:8807
Class :character Class :character
Mode :character Mode :character
skim(Netflix_Data)
Data summary
Name
Netflix_Data
Number of rows
8807
Number of columns
18
_______________________
Column type frequency:
character
17
numeric
1
________________________
Group variables
None
Variable type: character
skim_variable
n_missing
complete_rate
min
max
empty
n_unique
whitespace
show_id
0
1.00
2
5
0
8807
0
type
0
1.00
5
7
0
2
0
title
0
1.00
1
104
0
8807
0
director
2634
0.70
2
208
0
4528
0
cast
825
0.91
3
771
0
7692
0
country
831
0.91
4
123
0
748
0
month_added
10
1.00
3
9
0
12
0
day_added
10
1.00
1
2
0
31
0
year_added
10
1.00
4
4
0
14
0
rating
4
1.00
1
8
0
17
0
duration
3
1.00
5
10
0
220
0
genres
0
1.00
6
79
0
514
0
description
0
1.00
61
248
0
8775
0
number_seasons
6131
0.30
1
2
0
15
0
duration_units.x
6131
0.30
6
7
0
2
0
duration_min
2679
0.70
1
3
0
205
0
duration_units.y
2679
0.70
3
3
0
1
0
Variable type: numeric
skim_variable
n_missing
complete_rate
mean
sd
p0
p25
p50
p75
p100
hist
release_year
0
1
2014.18
8.82
1925
2013
2017
2019
2021
▁▁▁▁▇
Interpretations/meanings of specific metrics (e.g., counts, means, proportions, sentiment values, centrality measures, etc.) that your analysis generated.
Data visualizations that are attractive and easy to interpret, and include text or narrative for aiding their Interpretation by others.
This bar graph shows the the number of movies and tv shows which have been added each year.
ggplot(data = Netflix_Data) +geom_bar(mapping =aes(x = release_year, fill = type), width =1, position ="dodge") +xlab("Year Released") +ylab("Number of Media")+labs(title ="Netlix media types over time")
#look at the ratings over time#ggplot(data = Netflix_Data) +geom_bar(mapping =aes(x = release_year, fill = rating)) +coord_cartesian(xlim =c(2000, 2021))
ggplot(data =subset(Netflix_Data, !is.na(number_seasons))) +geom_bar(mapping =aes(x = number_seasons)) +xlab("Number of Seasons") +ylab("Number of TV Shows")+labs(title ="Netflix TV Number of Seasons ")
Communication
Your data product should demonstrate your ability to clearly and effectively communicate the most important and most useful findings. Specifically, your data product should:
Highlights key finding and insights in response to your research questions.
The first bar graph shows how the added media favors recent content and how there is a much higher number of movies added compared to tv shows. One other interesting aspect to note is how tv shows surpassed movies for the first time in 2021. Part of this might be attributed to the COVID 19 pandemic, but it is also notable how the number of movies added has decreased over the most recent years. This might indicate that the streaming service is starting to focus more on tv shows, especially with the popularity of exclusive content to compete with other streaming services. The decrease in movies might also be related to restrictions on streaming movies that are currently in theaters.
The second bar graph shows the tv ratings over time. It s
Suggests potential action that you and/or your target audience to better understand and improve the context in which your data product is intended to inform.
Discusses the limitations and any ethical/legal issues taken into consideration, including acknowledgments any reference materials used.
There are some limitations in this data set because not all data is present. Some media did not have listed directors or cast, even when some exist. “On The Verge” does not have a listed director in this data set even though a quick google search reveals that the directors include Julie Delpy, Mathieu Demy, and David Petrarca. The limits of this data may affect certain social network analysis if nodes are missing.
Assessment
This assignment is worth 18 points total. You will receive 1,5 point (15 points total) for each of the project criteria adequately addressed by your data product, and 3 point for rendering and publishing your work in GitHub/QuartoPubs/RPubs environment.