Skip to content

Instantly share code, notes, and snippets.

@MonkmanMH
Created January 6, 2016 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MonkmanMH/cf6b8b2dda385536f010 to your computer and use it in GitHub Desktop.
Save MonkmanMH/cf6b8b2dda385536f010 to your computer and use it in GitHub Desktop.
Work-around quick fix for inconsistent date values in the Master table of the Lahman package (R)
#
library(Lahman)
data(Master)
#
# `debut` variable; create new version `debutDate`
Master$debutDate <- (as.Date(Master$debut, "%m/%d/%Y"))
Master$debutDate[is.na(Master$debutDate)] <-
as.Date(Master$debut[is.na(Master$debutDate)])
#
# `finalGame` variable; create new version `finalGameDate`
Master$finalGameDate <- (as.Date(Master$finalGame, "%m/%d/%Y"))
Master$finalGameDate[is.na(Master$finalGameDate)] <-
as.Date(Master$finalGame[is.na(Master$finalGameDate)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment