game_films <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-06-09/game_films.csv')
## Rows: 439 Columns: 20
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (14): category, subcategory, title, director, release_date_raw, air_dat...
## dbl (5): worldwide_box_office, rotten_tomatoes, metacritic, budget_low, bu...
## date (1): release_date
##
## ℹ 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.
Case of numeric variables
game_films %>%
select(where(is.numeric)) %>%
map(mean, na.rm = TRUE)
## $worldwide_box_office
## [1] 674816191
##
## $rotten_tomatoes
## [1] 35.17808
##
## $metacritic
## [1] 37.36508
##
## $budget_low
## [1] 63632836
##
## $budget_high
## [1] 65901493
Create your own function
average_columns <- function(data) {
data %>%
select(where(is.numeric)) %>%
map(mean, na.rm = TRUE)
}
average_columns(game_films)
## $worldwide_box_office
## [1] 674816191
##
## $rotten_tomatoes
## [1] 35.17808
##
## $metacritic
## [1] 37.36508
##
## $budget_low
## [1] 63632836
##
## $budget_high
## [1] 65901493
When you have a grouping variable (factor)
game_films %>%
group_by(title) %>%
summarise(total = n())
## # A tibble: 425 × 2
## title total
## <chr> <int>
## 1 100 Yen: The Japanese Arcade Experience 1
## 2 8BIT 1
## 3 99 Nights in the Forest 1
## 4 A Minecraft Movie 1
## 5 A Minecraft Sequel 1
## 6 Abe's Exoddus: The Movie 1
## 7 Ace Attorney 1
## 8 Aikatsu! Music Award: Minna de Shō o MoraimaSHOW! 1
## 9 Aikatsu! The Movie 1
## 10 Air 1
## # ℹ 415 more rows
Choose either one of the two cases above and apply it to your data
map(game_films, ~ sum(is.na(.x)))
## $category
## [1] 0
##
## $subcategory
## [1] 46
##
## $title
## [1] 0
##
## $director
## [1] 0
##
## $release_date
## [1] 89
##
## $release_date_raw
## [1] 13
##
## $air_date_raw
## [1] 426
##
## $worldwide_box_office_currency
## [1] 343
##
## $worldwide_box_office
## [1] 343
##
## $rotten_tomatoes
## [1] 366
##
## $metacritic
## [1] 376
##
## $cinema_score
## [1] 340
##
## $distributor
## [1] 226
##
## $original_game_publisher
## [1] 67
##
## $budget_currency
## [1] 376
##
## $budget_low
## [1] 372
##
## $budget_high
## [1] 372
##
## $domestic_box_office
## [1] 362
##
## $subject
## [1] 377
##
## $network
## [1] 426