beanumber / openWAR

An R package enabling the computation of openWAR using MLBAM data
99 stars 33 forks source link

Documentation for data.R #54

Closed gjm112 closed 9 years ago

gjm112 commented 9 years ago

Do it.

gjm112 commented 9 years ago

Do you know what the variable "actionID" is?

gjm112 commented 9 years ago

"RunsITD"? is this the number of runs that have already been scored in the half of the inning?

gjm112 commented 9 years ago

Ben can you remind me how we defined our.x and our.y coordinates? and how MLBAM defines theirs.

beanumber commented 9 years ago

actionId seems to be related to when substitutions get made, but it also is NA everywhere. This is a little disconcerting. If it's not a bug, then we should drop the column, but I'm not convinced yet.

beanumber commented 9 years ago

runsITD is runs inning-to-date, so yes, you've got it right.

beanumber commented 9 years ago

Look at recenter(). MLBAM defines their coordinates in terms of the stadium image file, where (0,0) is in the upper-left hand corner of the image. Our coordinates are defined in so that (0,0) is at home plate.

gjm112 commented 9 years ago

Thanks On Jun 24, 2015 2:18 PM, "Ben Baumer" notifications@github.com wrote:

Look at recenter(). MLBAM defines their coordinates in terms of the stadium image file, where (0,0) is in the upper-right hand corner of the image. Our coordinates are defined in so that (0,0) is at home plate.

— Reply to this email directly or view it on GitHub https://github.com/beanumber/openWAR/issues/54#issuecomment-114985105.

alejandroam4 commented 7 years ago

@beanumber , would recenter() work for x and y in the pitch table ( from PitchRx's scrape() function) like it does for the hip table?

beanumber commented 7 years ago

Are the x and y's field coordinates? If so, then probably. All recenter() does is change the coordinates from the MLBAM data. Can you post a code snippet?

alejandroam4 commented 7 years ago

The x and y are, according to PitchFX Glossary:

x, y: the horizontal and vertical location of the pitch as it crossed home plate as input by the Gameday stringer using the old Gameday coordinate system.

Here's a snippet of the pitch table:

                des           des_es id type        x        y
1             Foul             Foul  3    S 108.3599 135.9666
2  In play, out(s) En juego, out(s)  4    X 108.8094 153.8430
3  In play, out(s) En juego, out(s)  8    X 107.9105 154.3261
4             Ball        Bola mala 12    B 133.9778 102.1465
5  In play, out(s) En juego, out(s) 13    X 107.4611 162.0564
6    Called Strike   Strike cantado 18    S 106.1128 151.9104
7             Foul             Foul 19    S 126.7868 128.2363
8             Ball        Bola mala 20    B 154.2025 137.4161
9             Ball        Bola mala 21    B  54.8770 149.0115
10            Foul             Foul 22    S 116.4498 165.4384

I am looking at winter baseball leagues (Mexico)

beanumber commented 7 years ago

It sounds like those x's and y's are pitch location. recenter() works with field locations.

alejandroam4 commented 7 years ago

Do you have the source of where you got the transformation for field locations? Maybe there's a note on how to convert to pitch location.

beanumber commented 7 years ago

@alejandroam4 I'm sorry but I am not understanding your question. Why do you want to convert the pitch locations? And what is the relationship between pitch location and field location?