inst/scripts/dataMapping.R

# added to help maintain column naming consistency
library(dplyr)

mapHallOfFame <- function(df) {
  df <- df %>% rename(yearID = yearid)
  
  return(df)
}

mapHomeGames <- function(df) {
  colnames(df) <- gsub("(.*)key$", "\\1.key", colnames(df))
  colnames(df) <- gsub("^span(.*)", "span.\\1", colnames(df))
  
  return(df)
}

mapParks <- function(df) {
  colnames(df) <- gsub("^park(.*)", "park.\\1", colnames(df))
  df <- df %>% select(-ID)
  
  return(df)
}

mapPeople <- function(df) {
  df <- df %>% select(-ID)
  
  return(df)
}

Try the Lahman package in your browser

Any scripts or data that you put into this service are public.

Lahman documentation built on Feb. 12, 2026, 9:09 a.m.