library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.1 ✔ purrr 1.0.1
## ✔ tibble 3.1.8 ✔ dplyr 1.1.0
## ✔ tidyr 1.3.0 ✔ stringr 1.5.0
## ✔ readr 2.1.4 ✔ forcats 1.0.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
youtube <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-03-02/youtube.csv')
## Rows: 247 Columns: 25
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): brand, superbowl_ads_dot_com_url, youtube_url, id, kind, etag, ti...
## dbl (7): year, view_count, like_count, dislike_count, favorite_count, comm...
## lgl (7): funny, show_product_quickly, patriotic, celebrity, danger, animal...
## dttm (1): published_at
##
## ℹ 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.
youtube_df <- youtube %>%
select(year, brand, funny, show_product_quickly, patriotic, celebrity, danger, animals, use_sex, view_count, like_count, dislike_count, comment_count) %>%
na.omit(year, brand, funny, show_product_quickly, patriotic, celebrity, danger, animals, use_sex, view_count, like_count, dislike_count, comment_count)
youtube_df
## # A tibble: 219 × 13
## year brand funny show_p…¹ patri…² celeb…³ danger animals use_sex view_…⁴
## <dbl> <chr> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <lgl> <dbl>
## 1 2020 Bud Light TRUE TRUE FALSE TRUE TRUE FALSE FALSE 47752
## 2 2006 Bud Light TRUE FALSE FALSE FALSE TRUE TRUE FALSE 142310
## 3 2018 Hynudai FALSE TRUE FALSE FALSE FALSE FALSE FALSE 198
## 4 2003 Bud Light TRUE TRUE FALSE FALSE TRUE TRUE TRUE 13741
## 5 2020 Toyota TRUE TRUE FALSE TRUE TRUE TRUE FALSE 23636
## 6 2020 Coca-Cola TRUE FALSE FALSE TRUE FALSE TRUE FALSE 304254
## 7 2020 Kia FALSE FALSE FALSE TRUE FALSE FALSE FALSE 17892
## 8 2020 Hynudai TRUE TRUE FALSE TRUE FALSE TRUE FALSE 38385
## 9 2020 Budweiser FALSE TRUE TRUE TRUE TRUE FALSE FALSE 782
## 10 2010 Hynudai FALSE TRUE TRUE FALSE FALSE FALSE FALSE 68458
## # … with 209 more rows, 3 more variables: like_count <dbl>,
## # dislike_count <dbl>, comment_count <dbl>, and abbreviated variable names
## # ¹show_product_quickly, ²patriotic, ³celebrity, ⁴view_count