3  inclass2.qmd

Published

November 1, 2023

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.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ 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(foreign)

library(intsvy)

library(dplyr)

library(tidyr)

library(ggplot2)
netflix=readr::read_csv("netflix.csv")
Rows: 1000 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): title, rating, ratinglevel
dbl (4): ratingdescription, release_year, user_rating_score, user_rating_size

ℹ 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
# A tibble: 1,000 × 7
   title     rating ratinglevel ratingdescription release_year user_rating_score
   <chr>     <chr>  <chr>                   <dbl>        <dbl>             <dbl>
 1 White Ch… PG-13  crude and …                80         2004                82
 2 Lucky Nu… R      strong vio…               100         2006                NA
 3 Grey's A… TV-14  Parents st…                90         2016                98
 4 Prison B… TV-14  Parents st…                90         2008                98
 5 How I Me… TV-PG  Parental g…                70         2014                94
 6 Supernat… TV-14  Parents st…                90         2016                95
 7 Breaking… TV-MA  For mature…               110         2013                97
 8 The Vamp… TV-14  Parents st…                90         2017                91
 9 The Walk… TV-MA  For mature…               110         2015                98
10 Pretty L… TV-14  Parents st…                90         2016                96
# ℹ 990 more rows
# ℹ 1 more variable: user_rating_size <dbl>
ggplot(netflix %>% select(release_year, user_rating_score) %>%
filter(complete.cases(.)), 
aes(x = release_year, y = user_rating_score)) + 
geom_point()+
labs(
  title= "Movie Information",
  x= "Year of the movie",
  y= "User Rating"
  )