Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve no-substitution parsing error #7

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

colindouglas
Copy link

getRetrosheet() fails to parse the downloaded data correctly for games where there are no substitutions. This is relatively rare in recent games (it requires opposing pitchers to both pitch full games), but is common in older games.

A reproducible example is:
retrosheet::getRetrosheet(type = "play", year = 2015, team = "COL", stringsAsFactors = FALSE)

Specifically, this fails on index 12, gameID "COL201505080".
https://www.baseball-reference.com/boxes/COL/COL201505080.shtml

By checking if there are any substitutions before trying to name the columns, we avoid the problem and return NULL for the .$sub list in games where there were no subs.

getRetrosheet() fails to parse the downloaded data correctly for games where there are no substitutions.
This is relatively rare in recent games (it requires opposing pitchers to both pitch full games),
but is common in older games.

A reproducible example is:
retrosheet::getRetrosheet(type = "play", year = 2015, team = "COL", stringsAsFactors = FALSE)

Specifically, this fails on index 12, gameID "COL201505080".
https://www.baseball-reference.com/boxes/COL/COL201505080.shtml

By checking if there are any substitutions before trying to name the columns, we avoid the problem and
return NULL for the .$sub list in games where
…s represented as an empty column instead of NULL.

Merge branch 'master' of https://github.com/colindouglas/retrosheet

# Conflicts:
#	R/getRetrosheet.R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant