Created
January 6, 2016 05:11
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
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