Retrosheet Data

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Retrosheet Data

Have used Jim Albert’s code to extract baseball data from Retrosheet.

P <- getRetrosheet("play",2013,team)
   get_plays <- function(j) data.frame(Game=P[[j]]$id[1],P[[j]]$play)#from $id and $play section of retrosheet data"rbind",lapply(1:length(P),get_plays))
all_plays <-"rbind",lapply(Teams[1:30],get_team_plays))

I get the following six variables from the play section of the retrosheet data:

    Game                    inning team  retroID        count  pitches play
1  TEX201304050      1         0        troum001    01      CX         63/G
2  TEX201304050      1         0        aybae001    12      TBFX     7/F
3  TEX201304050      1         0        pujoa001     00      X           6/L
4  TEX201304050      1         1        kinsi001      02      FCX        53/G  

Very useful but I would also like to access the $info, $start, $sub, and $data sections.  I have tried replacing $play in the line below with $info, $start, etc. without success.  

 get_plays <- function(j) data.frame(Game=P[[j]]$id[1],P[[j]]$play) with

get_plays <- function(j) data.frame(Game=P[[j]]$id[1],P[[j]]$info)

I keep getting the same Game, inning, team, etc. data.

Can anyone give me some direction.

Philip Heinrich

        [[alternative HTML version deleted]]

[hidden email] mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.