需要一些建议才能开始使用 retrosheets。(MLB 的棒球数据)
Need for some advice to get started in retrosheets.(Baseball data for MLB)
我正在尝试了解如何使用 retrosheet 中的事件文件(逐个播放数据)。在跳过 Chadwick 工具之前,我还想了解如何使用 retrosheet 提供的 DiamondWare 工具。我正在关注 http://www.retrosheet.org/stepex.txt,但我认为此信息已过时(也许我错了),因为它使用“1982al.zip”并且我在网页中找不到此数据格式。
我还看到一些工具已经在 Python 和 R 中开发。我尝试使用 tha R-package "retrosheet" (https://github.com/rmscriven/retrosheet) 但它没有很好地工作 (也许是因为我的无知)。
我想学习,所以我的问题是:谁能给我推荐一个"tutorial"或"guide",或者给我一些开始使用retrosheet的建议?开始使用 retrosheet 的最快最好的方法是什么?
非常感谢您的预付款。
塞尔吉奥。
The retrosheet package and Retrosheet Package, Part 2 posts by the Exploring Baseball Data with R blog walk the reader through a few use cases of the retrosheet
r 包。
前者关注堪萨斯城皇家队 2014-2015 赛季的赛程,后者探索迈克·特劳特 2013 年的本垒打。
更新
看来 retrosheet
不再维护了。如果您想使用它,我不建议您从 CRAN 安装它。相反,您应该使用拉取请求版本 - keberwein/retrosheet - 它修复了 getRetrosheet()
函数。
为此,请遵循以下代码:
# assuming you've already installed retrosheet
# remove unmaintained version of retrosheet
remove.packages( pkgs = "retrosheet" )
# install devtools to enable you to download packages from GitHub
install.packages( pkgs = "devtools" )
library( devtools )
# install PR request version of retrosheet
install_github( repo = "keberwein/retrosheet" )
# load retrosheet
library( retrosheet )
# download 2017 MLB rosters
roster.2017 <- getRetrosheet( type = "roster", year = 2017)
# check the dimension of each data frame in roster.2017
lapply( X = roster.2017, FUN = dim )
# $ARI
# [1] 45 7
#
# $ATL
# [1] 49 7
#
# $BAL
# [1] 50 7
#
# $BOS
# [1] 49 7
#
# $CHA
# [1] 51 7
#
# $CHN
# [1] 47 7
#
# $CIN
# [1] 47 7
#
# $CLE
# [1] 41 7
#
# $COL
# [1] 41 7
#
# $DET
# [1] 49 7
#
# $HOU
# [1] 46 7
#
# $KCA
# [1] 49 7
#
# $LAN
# [1] 52 7
#
# $MIA
# [1] 43 7
#
# $MIL
# [1] 50 7
#
# $MIN
# [1] 52 7
#
# $NYA
# [1] 51 7
#
# $NYN
# [1] 52 7
#
# $OAK
# [1] 54 7
#
# $PHI
# [1] 51 7
#
# $PIT
# [1] 47 7
#
# $SDN
# [1] 52 7
#
# $SEA
# [1] 61 7
#
# $SFN
# [1] 49 7
#
# $SLN
# [1] 48 7
#
# $TBA
# [1] 53 7
#
# $TEX
# [1] 51 7
#
# $TOR
# [1] 60 7
#
# $WAS
# [1] 49 7
# end of script #
我正在尝试了解如何使用 retrosheet 中的事件文件(逐个播放数据)。在跳过 Chadwick 工具之前,我还想了解如何使用 retrosheet 提供的 DiamondWare 工具。我正在关注 http://www.retrosheet.org/stepex.txt,但我认为此信息已过时(也许我错了),因为它使用“1982al.zip”并且我在网页中找不到此数据格式。
我还看到一些工具已经在 Python 和 R 中开发。我尝试使用 tha R-package "retrosheet" (https://github.com/rmscriven/retrosheet) 但它没有很好地工作 (也许是因为我的无知)。
我想学习,所以我的问题是:谁能给我推荐一个"tutorial"或"guide",或者给我一些开始使用retrosheet的建议?开始使用 retrosheet 的最快最好的方法是什么?
非常感谢您的预付款。
塞尔吉奥。
The retrosheet package and Retrosheet Package, Part 2 posts by the Exploring Baseball Data with R blog walk the reader through a few use cases of the retrosheet
r 包。
前者关注堪萨斯城皇家队 2014-2015 赛季的赛程,后者探索迈克·特劳特 2013 年的本垒打。
更新
看来 retrosheet
不再维护了。如果您想使用它,我不建议您从 CRAN 安装它。相反,您应该使用拉取请求版本 - keberwein/retrosheet - 它修复了 getRetrosheet()
函数。
为此,请遵循以下代码:
# assuming you've already installed retrosheet
# remove unmaintained version of retrosheet
remove.packages( pkgs = "retrosheet" )
# install devtools to enable you to download packages from GitHub
install.packages( pkgs = "devtools" )
library( devtools )
# install PR request version of retrosheet
install_github( repo = "keberwein/retrosheet" )
# load retrosheet
library( retrosheet )
# download 2017 MLB rosters
roster.2017 <- getRetrosheet( type = "roster", year = 2017)
# check the dimension of each data frame in roster.2017
lapply( X = roster.2017, FUN = dim )
# $ARI
# [1] 45 7
#
# $ATL
# [1] 49 7
#
# $BAL
# [1] 50 7
#
# $BOS
# [1] 49 7
#
# $CHA
# [1] 51 7
#
# $CHN
# [1] 47 7
#
# $CIN
# [1] 47 7
#
# $CLE
# [1] 41 7
#
# $COL
# [1] 41 7
#
# $DET
# [1] 49 7
#
# $HOU
# [1] 46 7
#
# $KCA
# [1] 49 7
#
# $LAN
# [1] 52 7
#
# $MIA
# [1] 43 7
#
# $MIL
# [1] 50 7
#
# $MIN
# [1] 52 7
#
# $NYA
# [1] 51 7
#
# $NYN
# [1] 52 7
#
# $OAK
# [1] 54 7
#
# $PHI
# [1] 51 7
#
# $PIT
# [1] 47 7
#
# $SDN
# [1] 52 7
#
# $SEA
# [1] 61 7
#
# $SFN
# [1] 49 7
#
# $SLN
# [1] 48 7
#
# $TBA
# [1] 53 7
#
# $TEX
# [1] 51 7
#
# $TOR
# [1] 60 7
#
# $WAS
# [1] 49 7
# end of script #