Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

TeamsFranchises

TeamFranchises table


Description

Information about team franchises

Usage

data(TeamsFranchises)

Format

A data frame with 120 observations on the following 4 variables.

franchID

Franchise ID; a factor

franchName

Franchise name

active

Whether team is currently active (Y or N)

NAassoc

ID of National Association team franchise played as

Source

Lahman, S. (2021) Lahman's Baseball Database, 1871-2020, 2020 version, https://www.seanlahman.com/baseball-archive/statistics/

Examples

data(TeamsFranchises)

# Which of the active Major League Baseball teams had a National Association predecessor?

# Notes: 
# - the National Association was founded in 1871, and continued through the
# 1875 season. In 1876, six clubs from the National Association and two other
# independent clubs formed the National League, which exists to this day.
# - the `active` field has "NA" for the National Association franchises
# - where appropriate, the `NAassoc` field has the `franchID` of the successor National League team

# using the dplyr data manipulation package
library("dplyr")

NatAssoc_active_table <- TeamsFranchises %>%
  filter(active == "Y") %>%
  filter(!is.na(NAassoc))
NatAssoc_active_table

# Merge current team IDs with franchise IDs
currentTeams <- Teams %>% 
                  filter(yearID == 2014) %>%
                  select(teamID, franchID, lgID, park)

# Merge TeamsFranchises with currentTeams
TeamsFranchises %>%
    filter(active == "Y") %>%
    select(-active, -NAassoc) %>%
    left_join(currentTeams, by = "franchID")

Lahman

Sean 'Lahman' Baseball Database

v10.0-1
GPL
Authors
Michael Friendly [aut], Chris Dalzell [cre, aut], Martin Monkman [aut], Dennis Murphy [aut], Vanessa Foot [ctb], Justeena Zaki-Azat [ctb], Sean Lahman [cph]
Initial release
2022-04-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.