Skip to content

Instantly share code, notes, and snippets.

@mattdennewitz
Created September 18, 2011 23:09
Show Gist options
  • Select an option

  • Save mattdennewitz/1225694 to your computer and use it in GitHub Desktop.

Select an option

Save mattdennewitz/1225694 to your computer and use it in GitHub Desktop.
Retrosheet/wOBA mapping function
function() {
var woba_fields = {nibb: (this.EVENT_CD == '14') ? 1 : 0,
hbp: (this.EVENT_CD == '15') ? 1 : 0,
_1b: (this.EVENT_CD == '20') ? 1 : 0,
_2b: (this.EVENT_CD == '21') ? 1 : 0,
_3b: (this.EVENT_CD == '22') ? 1 : 0,
hr: (this.EVENT_CD == '23') ? 1 : 0,
rboe: (this.BAT_SAFE_ERR_FL == 'T') ? 1 : 0,
pa: 1};
emit(this.BAT_ID, woba_fields);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment