Load data from the CSV file
df <- read.csv("Netflix.csv")
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
Count the number of appearances for each actor
top_actors <- df %>%
group_by(actor) %>%
summarise(appearances = n()) %>%
arrange(desc(appearances)) %>%
head(6)
Select the top six actors
Display the top actors
print(top_actors)
## # A tibble: 6 × 2
## actor appearances
## <chr> <int>
## 1 "" 570
## 2 "Anupam Kher" 33
## 3 "Shah Rukh Khan" 30
## 4 "Naseeruddin Shah" 27
## 5 "Om Puri" 27
## 6 "Akshay Kumar" 26