I'm working with a baseball statistical database, Retrosheet event files, to try to create an encyclopedia for each player of Games Played, Games Started, And number of games played each year as starter in each batting order position versus left handed pitchers and versus right handed pitchers. A sample of the relevant columns I need to access is below. It shows each plate appearance by batter aaroh101 in four games played by Team MLN in 1954.
The output I want is:
Columns:Batter, Year, GP, GS, 3vRHP, 4vRHP, 6vRHP, 3vLHP, 4vLHP, 6vLHP
Results: aaroh101, 1954, 4, 4, 1, 1, 1, 0, 1, 0
I can't figure out how to count only 1 row in each distinct game in which a player started and then segregate out his batting order position depending on whether he faced a left handed pitcher or right handed pitcher. Can anyone point me in the right direction?