Ensure Folder Exists and Load Netflix Dataset
# Define folder path
folder_path <- "/Users/faizhaikal/Desktop/Netflix"
# Create folder if it doesn't exist
dir.create(folder_path, showWarnings = FALSE)
# Prompt user to move Netflix.csv to this folder, then read it
Netflix_file <- file.path(folder_path, "Netflix.csv")
if (!file.exists(Netflix_file)) {
stop(paste("Please move Netflix.csv to", folder_path))
}
# Read CSV with UTF-8 encoding
Netflix <- read_csv(Netflix_file, locale = locale(encoding = "UTF-8"))
## 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.
glimpse(Netflix)
## Rows: 6,234
## Columns: 12
## $ show_id <dbl> 81145628, 80117401, 70234439, 80058654, 80125979, 8016389…
## $ type <chr> "Movie", "Movie", "TV Show", "TV Show", "Movie", "TV Show…
## $ title <chr> "Norm of the North: King Sized Adventure", "Jandino: What…
## $ director <chr> "Richard Finn, Tim Maltby", NA, NA, NA, "Fernando Lebrija…
## $ cast <chr> "Alan Marriott, Andrew Toth, Brian Dobson, Cole Howard, J…
## $ country <chr> "United States, India, South Korea, China", "United Kingd…
## $ date_added <chr> "September 9, 2019", "September 9, 2016", "September 8, 2…
## $ release_year <dbl> 2019, 2016, 2013, 2016, 2017, 2016, 2014, 2017, 2017, 201…
## $ rating <chr> "TV-PG", "TV-MA", "TV-Y7-FV", "TV-Y7", "TV-14", "TV-MA", …
## $ duration <chr> "90 min", "94 min", "1 Season", "1 Season", "99 min", "1 …
## $ listed_in <chr> "Children & Family Movies, Comedies", "Stand-Up Comedy", …
## $ description <chr> "Before planning an awesome wedding for his grandfather, …