data-raw/nba_finals/nba_finals-dataprep.R

# Load packages --------------------------------------------------------------

library(readr)
library(dplyr)
library(tidyr)

# Load data ------------------------------------------------------------------

raw_data <- read_csv(here::here("data-raw/nba_finals/nba_finals.csv"))

# Cleaning: ------------------------------------------------------------------

nba_finals <- raw_data |>
  janitor::clean_names() |>
  separate(col = "series", into = c("western_wins", "eastern_wins"), sep = "-")

# Save -----------------------------------------------------------------------

usethis::use_data(nba_finals, overwrite = TRUE)
OpenIntroStat/openintro documentation built on June 4, 2024, 4:19 a.m.