Code

NBA games that ended with the same score on the same day

Yesterday, during Round of 16 of the FIBA EuroBasket 2022, three matches ended with the same score, 94-86.

I wanted to see if this has happened before in the tournament. I couldn't find a data set and scraping the results wasn't as straightforward as I thought. So, I turned to NBA instead.

I downloaded the [Basketball Dataset](https://www.kaggle.com/datasets/wyattowalsh/basketball) from Kaggle, that contains data on every game since the first NBA season in 1946-47.

The data set is actually an SQLite database, so I used the RSQLite package to read the file and get a list of the tables:

library(RSQLite)
library(tidyverse)
con <- dbConnect(drv = RSQLite::SQLite(), dbname = "nba.sqlite")
tables <- dbListTables(con)
tables <- tables[tables != "sqlite_sequence"]

There are 16 tables, the one with the game results is Game

tables
 [1] "Draft"                 "Draft_Combine"         "Game"                 
 [4] "Game_Inactive_Players" "Game_Officials"        "News"                 
 [7] "News_Missing"          "Player"                "Player_Attributes"    
[10] "Player_Bios"           "Player_Photos"         "Player_Salary"        
[13] "Team"                  "Team_Attributes"       "Team_History"         
[16] "Team_Salary" 

The next step was to get just the Game table:

games <- dbGetQuery(conn=con, statement=paste("SELECT * FROM 'Game'", sep=""))

I cleaned the variable names and selected the columns of interest, then remove duplicate rows:

scores <- games %>% 
  janitor::clean_names() %>% 
  select(game_id, game_date, team_name_home, team_name_away, pts_home, pts_away) %>% 
  distinct()

In order to count the same scores for each date, I created a new column with each game’s score as a sorted list. That means that two games that ended, for example, with 86-64 and 64-86, appear in the same way, as c(86, 64).

The final step was to add a count of scores by date and sort it:

score_counts <- scores %>% 
  rowwise() %>% 
  mutate(score = list(sort(c(pts_home, pts_away)))) %>% 
  ungroup() %>% 
  add_count(game_date, score, sort = TRUE)

It looks like that the same score has appeared three times on the same day only once, on March 5, 2003. That’s one date of the 11,015 dates in the database. If we consider only dates with three or more games, it is 1 in 9,079, or 0.01%.

tidytuesday

@steam_games for this week’s #TidyTuesday, dataset by @brightcdns via @Steam_Spy.

I looked at the most expensive titles and found among the design and developing tools games with prices way higher than any AAA game.

code: http://bit.ly/tidytue31


Most of the games are of questionable quality and use high prices as a discount strategy. The most expensive game, ADR-Labeling Game, at $595.99, is marketed as a game and an interactive training platform. Found some gems when reading the descriptions on Steam:

Tactics 2: War ($199.99)

For russians, the entrance to this page is $ 1,000,000,000,000 for 1 second. If you are russian or a citizen of russia and if you came here by chance, then you are obliged to either immediately leave or pay a penalty in the specified amount.

Bible Test ($199.99)

Bible Test is a test for a real connoisseur of this invaluable book.

Discounted 70% when bundled with 6 under-a-dollar games, such as Pussy Password, Hentai Casino and Kamasutra. Nice.