| Schools | R Documentation | 
Information on schools players attended, by school
data(Schools)A data frame with 1241 observations on the following 5 variables.
schoolIDschool ID code
name_fullschool name
citycity where school is located
statestate where school's city is located
countrycountry where school is located
Lahman, S. (2024) Lahman's Baseball Database, 1871-2023, 2024 version, http://www.seanlahman.com/
require("dplyr")
# How many different schools are listed in each state?
table(Schools$state)
 
# How many different schools are listed in each country?
table(Schools$country)
# Top 20 schools 
schoolInfo <- Schools %>% select(-country)
schoolCount <- CollegePlaying %>%
                 group_by(schoolID) %>%
                 summarise(players = length(schoolID)) %>%
                 left_join(schoolInfo, by = "schoolID") %>%
                 arrange(desc(players)) 
head(schoolCount, 20)
# sum counts by state
schoolStates <- schoolCount %>%
                  group_by(state) %>%
                  summarise(players = sum(players),
                            schools = length(state))
str(schoolStates)
summary(schoolStates)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.