library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── 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
movie_data <- read.csv(file = "~/Downloads/IMDBMovies (2).csv")
thriller_data <- filter(movie_data, Genre=="Comedy", Year==2016)
thriller_data <- thriller_data[c("Title", "Year", "Rating", "Runtime")]
sort_movie_data <- arrange(thriller_data, desc(Rating))
best_movie_data <- sort_movie_data[1:10,]
print(best_movie_data)
## Title Year Rating Runtime
## 1 La La Land 2016 8.3 128
## 2 Sing Street 2016 8.0 106
## 3 Captain Fantastic 2016 7.9 118
## 4 Perfetti sconosciuti 2016 7.7 97
## 5 Mr. Church 2016 7.7 104
## 6 Toni Erdmann 2016 7.6 162
## 7 Paterson 2016 7.5 118
## 8 The Edge of Seventeen 2016 7.4 104
## 9 20th Century Women 2016 7.4 119
## 10 Demain tout commence 2016 7.4 118
ggplot(thriller_data, aes(x=Rating, y=Runtime)) + geom_point() +
labs(title = "Rating and Runtime of 2016 Comedy Movies", x = "Rating", y = "Runtime")
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.