title: “Netflix TV Show Actor Analysis” author: “Bayartsetseg” date: “2025-10-06” output: html_document —get
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.1 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── 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
Netflix <- read_csv("Netflix.csv")
## Rows: 6234 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): type, title, director, cast, country, date_added, rating, duration...
## dbl (2): show_id, 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.
Netflix_Actor <- Netflix %>%
separate_rows(cast, sep = ", ") %>%
drop_na(cast) %>%
rename(actor = cast)
Top_Actors <- Netflix_Actor %>%
select(type, actor) %>%
filter(type == "TV Show") %>%
group_by(actor) %>%
count(sort = TRUE) %>%
ungroup() %>%
head(6)
Top_Actors
## # A tibble: 6 × 2
## actor n
## <chr> <int>
## 1 Takahiro Sakurai 18
## 2 Yuki Kaji 16
## 3 Daisuke Ono 14
## 4 David Attenborough 14
## 5 Ashleigh Ball 12
## 6 Hiroshi Kamiya 12
Top_Actors %>%
ggplot(aes(x = reorder(actor, n), y = n, fill = actor)) +
geom_col(show.legend = FALSE) +
coord_flip() +
labs(
title = "Top 6 Most Frequent TV Show Actors on Netflix",
x = "Actor",
y = "Number of Appearances"
) +
theme_minimal()