Skip to content

Commit

Permalink
Removed Master table
Browse files Browse the repository at this point in the history
  • Loading branch information
cdalzell committed Apr 5, 2022
1 parent d317d4e commit 4c672d9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 106 deletions.
4 changes: 4 additions & 0 deletions NEWS
@@ -1,3 +1,7 @@
Version 10.0-0 (2022-04-07)
o Updated with data for the 2021 season
o Removed Master table which has been replaced by the People table

Version 9.0-0 (2021-04-09)

o Updated with data for the 2020 season
Expand Down
Binary file removed data/Master.RData
Binary file not shown.
1 change: 0 additions & 1 deletion data/datalist
Expand Up @@ -13,7 +13,6 @@ FieldingPost
HallOfFame
Managers
ManagersHalf
Master
Parks
People
Pitching
Expand Down
11 changes: 5 additions & 6 deletions demo/lahman-dplyr.R
Expand Up @@ -23,18 +23,17 @@ batting2 <- merge(batting,


# Add name, age and bat hand information from People
master <- select(tbl_df(People), playerID, birthYear, birthMonth,
people <- select(tbl_df(People), playerID, birthYear, birthMonth,
nameLast, nameFirst, bats)
batting <- batting %>%
left_join(master) %>%
left_join(people) %>%
mutate(age = yearID - birthYear - ifelse(birthMonth < 10, 0, 1)) %>%
select(-(birthYear:birthMonth))

# same with base R
People[, c('playerID', 'birthYear', 'birthMonth',
'nameLast', 'nameFirst', 'bats')]
batting2 <- merge(batting, masterInfo, all.x = TRUE)
batting2$age <- with(batting, yearID - birthYear -
People[, c('playerID', 'birthYear', 'birthMonth', 'nameLast', 'nameFirst', 'bats')]
batting2 <- merge(batting, people, all.x = TRUE)
batting2$age <- with(batting2, yearID - birthYear -
ifelse(birthMonth < 10, 0, 1))

#' ## Queries about players
Expand Down
8 changes: 1 addition & 7 deletions inst/scripts/readLahman.R
Expand Up @@ -21,7 +21,7 @@ unzip(dataFile, exdir=indir)

# Read the Lahman MLB .csv files and create .RData and .Rd files
#Batting <- read.csv(file="Batting.csv", header=TRUE, stringsAsFactors=FALSE, na.strings="")
#Master <- read.csv(file="Master.csv", header=TRUE, stringsAsFactors=FALSE)
#People <- read.csv(file="People", header=TRUE, stringsAsFactors=FALSE)


indir <- paste0(indir, "/baseballdatabank-2022.2")
Expand Down Expand Up @@ -83,7 +83,6 @@ People <- within(People, {
# Warning: found non-ASCII string(s)
# 'named Guillermo VelC!zquez' in object 'Master'
# 'Martmn Magdaleno Dihigo (Llanos)' in object 'Master'

tools:::showNonASCII(paste0(indir, '/core/People.csv'))

# then, fix manually, because I don't know an R way ...
Expand Down Expand Up @@ -121,11 +120,6 @@ save(Teams, file="Teams.RData", version = 2)
save(TeamsFranchises, file="TeamsFranchises.RData", version = 2)
save(TeamsHalf, file="TeamsHalf.RData", version = 2)

# Master table was changed to People in the 2017 data
# We will maintain Master as part of the package for now as it's likely to be a breaking change
Master <- People
save(Master, file="Master.RData", version = 2)

# version currently still defaults to 2 here, but setting for backwards compatibility
tools::resaveRdaFiles(outdir, compress="xz", compression_level=9, version = 2)

Expand Down
92 changes: 0 additions & 92 deletions man/Master.Rd

This file was deleted.

0 comments on commit 4c672d9

Please sign in to comment.