Load the tidyr and dplyr libraries
library(tidyr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
Load data from the CSV file
df <- read.csv("Netflix.csv")
Filter the data to include only TV shows
tv_shows <- df %>%
filter(type == "TV Show")
Find the six actors with the most appearances in TV shows
top_actors <- tv_show_actors %>%
filter(actor != "") %>%
group_by(actor) %>%
summarise(appearances = n()) %>%
arrange(desc(appearances)) %>%
head(6)
print(top_actors)
## # A tibble: 6 × 2
## actor appearances
## <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