beanumber / openwar Goto Github PK
View Code? Open in Web Editor NEWAn R package enabling the computation of openWAR using MLBAM data
An R package enabling the computation of openWAR using MLBAM data
We have a number of issues here:
* using log directory ‘/home/bbaumer/Dropbox/lib/openWAR.Rcheck’
* using R version 3.1.3 (2015-03-09)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘openWAR/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘openWAR’ version ‘0.2.2.9000’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
data/.~lock.20130331-20130630.csv#
These were most likely included in error. See section ‘Package
structure’ in the ‘Writing R Extensions’ manual.
* checking for portable file names ... WARNING
Found the following file with a non-portable file name:
data/.~lock.20130331-20130630.csv#
These are not fully portable file names.
See section ‘Package structure’ in the ‘Writing R Extensions’ manual.
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘openWAR’ can be installed ... OK
* checking installed package size ... NOTE
installed size is 43.5Mb
sub-directories of 1Mb or more:
data 2.4Mb
extdata 40.1Mb
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... NOTE
Non-standard files/directories found at top level:
‘README.html’ ‘index.html’
* checking for left-over files ... OK
* checking index information ... WARNING
Empty or missing file ‘demo/00Index’.
See sections ‘The INDEX file’ and ‘Package subdirectories’ in the
‘Writing R Extensions’ manual.
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... WARNING
'::' or ':::' import not declared from: ‘RColorBrewer’
Namespace in Imports field not imported from: ‘Lahman’
All declared Imports should be used.
package 'methods' is used but not declared
* checking S3 generic/method consistency ... WARNING
summary:
function(object, ...)
summary.GameDayPlays:
function(data)
summary:
function(object, ...)
summary.do.openWARPlayers:
function(data, n, ...)
summary:
function(object, ...)
summary.openWARPlayers:
function(data, n, ...)
plot:
function(x, ...)
plot.GameDayPlays:
function(data, batterName, pitcherName, event, pch)
plot:
function(x, ...)
plot.do.openWARPlayers:
function(data, playerIds, ...)
plot:
function(x, ...)
plot.openWARPlayers:
function(data, ...)
See section ‘Generic functions and methods’ in the ‘Writing R
Extensions’ manual.
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
fieldingplot.formula: no visible global function definition for
‘contourplot’
fieldingplot.lm: no visible global function definition for ‘lhs’
flush.gameday: no visible binding for global variable ‘gd’
getData: no visible binding for global variable ‘game_type’
getData: no visible binding for global variable ‘gameId’
getData: no visible binding for global variable ‘inning’
getData: no visible binding for global variable ‘Innings’
getModelFieldingCollective: no visible binding for global variable
‘wasFielded’
getModelFieldingCollective: no visible binding for global variable
‘our.x’
getModelFieldingCollective: no visible binding for global variable
‘our.y’
getModelFieldingCollective: no visible binding for global variable
‘isOut’
getModelFieldingCollective: no visible binding for global variable
‘isHit’
getModelRunExpectancy.GameDayPlays: no visible binding for global
variable ‘outsInInning’
getRAA.openWARPlays: no visible binding for global variable ‘batterId’
getRAA.openWARPlays: no visible binding for global variable
‘batterName’
getRAA.openWARPlays: no visible binding for global variable ‘isPA’
getRAA.openWARPlays: no visible binding for global variable ‘gameId’
getRAA.openWARPlays: no visible binding for global variable ‘event’
getRAA.openWARPlays: no visible binding for global variable ‘raa.bat’
getRAA.openWARPlays: no visible binding for global variable ‘start1B’
getRAA.openWARPlays: no visible binding for global variable ‘raa.br1’
getRAA.openWARPlays: no visible binding for global variable ‘start2B’
getRAA.openWARPlays: no visible binding for global variable ‘raa.br2’
getRAA.openWARPlays: no visible binding for global variable ‘start3B’
getRAA.openWARPlays: no visible binding for global variable ‘raa.br3’
getRAA.openWARPlays: no visible binding for global variable ‘pitcherId’
getRAA.openWARPlays: no visible binding for global variable ‘raa.P’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.C’
getRAA.openWARPlays: no visible binding for global variable ‘raa.C’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.1B’
getRAA.openWARPlays: no visible binding for global variable ‘raa.1B’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.2B’
getRAA.openWARPlays: no visible binding for global variable ‘raa.2B’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.3B’
getRAA.openWARPlays: no visible binding for global variable ‘raa.3B’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.SS’
getRAA.openWARPlays: no visible binding for global variable ‘raa.SS’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.LF’
getRAA.openWARPlays: no visible binding for global variable ‘raa.LF’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.CF’
getRAA.openWARPlays: no visible binding for global variable ‘raa.CF’
getRAA.openWARPlays: no visible binding for global variable
‘playerId.RF’
getRAA.openWARPlays: no visible binding for global variable ‘raa.RF’
getRAA.openWARPlays: no visible binding for global variable
‘pitcherName’
getRAA.openWARPlays: no visible binding for global variable ‘raa.pitch’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.br1’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.br2’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.br3’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.bat’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.br’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.P’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.C’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.1B’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.2B’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.3B’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.SS’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.LF’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.CF’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.RF’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.pitch’
getRAA.openWARPlays: no visible binding for global variable ‘RAA.field’
getRAA.openWARPlays: no visible binding for global variable ‘PA.bat’
getRAA.openWARPlays: no visible binding for global variable ‘BF’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘batterId’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘start1B’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘start2B’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘start3B’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘pitcherId’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.C’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.1B’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.2B’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.3B’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.SS’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.LF’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.CF’
getReplacementActivity.openWARPlays: no visible binding for global
variable ‘playerId.RF’
getReplacementPlayers.openWARPlayers: no visible binding for global
variable ‘PA.bat’
getReplacementPlayers.openWARPlayers: no visible binding for global
variable ‘BF’
getRunEx: no visible binding for global variable ‘outsInInning’
getWAR.openWARPlays: no visible binding for global variable ‘RAA’
getWAR.openWARPlays: no visible binding for global variable ‘playerId’
makeWARBaserunning: no visible binding for global variable
‘runnerMovement’
makeWARBaserunning: no visible binding for global variable ‘start3B’
makeWARBaserunning: no visible binding for global variable ‘end3B’
makeWARBaserunning: no visible binding for global variable ‘dest.br3’
makeWARBaserunning: no visible binding for global variable ‘start2B’
makeWARBaserunning: no visible binding for global variable ‘dest.br2’
makeWARBaserunning: no visible binding for global variable ‘end2B’
makeWARBaserunning: no visible binding for global variable ‘start1B’
makeWARBaserunning: no visible binding for global variable ‘dest.br1’
makeWARBaserunning: no visible binding for global variable ‘end1B’
makeWARBaserunning : getCDF: no visible binding for global variable
‘basesAdvanced’
makeWARBaserunning : getCDF: no visible binding for global variable ‘N’
makeWARBaserunning : getCDF: no visible binding for global variable
‘numObs’
makeWARBaserunning: no visible binding for global variable ‘event’
makeWARBaserunning: no visible binding for global variable ‘startCode’
makeWARBaserunning: no visible binding for global variable ‘startOuts’
makeWARBaserunning: no visible binding for global variable ‘.’
makeWARBaserunning: no visible binding for global variable ‘cdf.lag’
makeWARFielding: no visible binding for global variable ‘fielderId’
panel.baseball: no visible binding for global variable ‘x’
panel.fielding: no visible global function definition for
‘panel.contourplot’
panel.war: no visible binding for global variable ‘RAA_pitch’
plot.GameDayPlays: no visible binding for global variable ‘our.y’
plot.GameDayPlays: no visible binding for global variable ‘our.x’
plot.do.openWARPlayers: no visible binding for global variable
‘batterId’
plot.openWARPlayers: no visible binding for global variable ‘PA.bat’
plot.openWARPlayers: no visible binding for global variable ‘BF’
plot.openWARPlayers: no visible binding for global variable
‘isReplacement’
readData.gameday: no visible binding for global variable ‘timestamp.x’
readData.gameday: no visible binding for global variable
‘runnerMovement’
readData.gameday: no visible binding for global variable ‘half’
readData.gameday: no visible binding for global variable ‘home_teamId’
readData.gameday: no visible binding for global variable ‘away_teamId’
readData.gameday: no visible binding for global variable ‘bo’
readData.gameday: no visible binding for global variable ‘teamId’
readData.gameday: no visible binding for global variable ‘batterPos’
readData.gameday: no visible binding for global variable ‘batterId’
readData.gameday: no visible binding for global variable ‘event’
readData.gameday: no visible binding for global variable ‘inning’
readData.gameday: no visible binding for global variable ‘.’
readData.gameday: no visible binding for global variable ‘ab_num’
readData.gameday: no visible binding for global variable ‘isPA’
readData.gameday: no visible binding for global variable ‘x’
readData.gameday: no visible binding for global variable ‘y’
recenter: no visible binding for global variable ‘x’
recenter: no visible binding for global variable ‘y’
recenter: no visible binding for global variable ‘our.x’
recenter: no visible binding for global variable ‘our.y’
recenter: no visible binding for global variable ‘r’
recenter: no visible binding for global variable ‘theta’
summary.do.openWARPlayers: no visible binding for global variable
‘Name’
summary.do.openWARPlayers: no visible binding for global variable ‘WAR’
summary.do.openWARPlayers: no visible binding for global variable ‘q50’
summary.openWARPlayers: no visible binding for global variable
‘RAA.pitch’
summary.openWARPlayers: no visible binding for global variable ‘Name’
summary.openWARPlayers: no visible binding for global variable ‘TPA’
summary.openWARPlayers: no visible binding for global variable ‘WAR’
summary.openWARPlayers: no visible binding for global variable ‘RAA’
summary.openWARPlayers: no visible binding for global variable ‘repl’
summary.openWARPlayers: no visible binding for global variable
‘RAA.bat’
summary.openWARPlayers: no visible binding for global variable ‘RAA.br’
summary.openWARPlayers: no visible binding for global variable
‘RAA.field’
tabulate.GameDayPlays: no visible binding for global variable ‘half’
tabulate.GameDayPlays: no visible binding for global variable
‘away_team’
tabulate.GameDayPlays: no visible binding for global variable
‘home_team’
tabulate.GameDayPlays: no visible binding for global variable ‘gameId’
tabulate.GameDayPlays: no visible binding for global variable ‘yearId’
tabulate.GameDayPlays: no visible binding for global variable
‘bat_team’
tabulate.GameDayPlays: no visible binding for global variable ‘isPA’
tabulate.GameDayPlays: no visible binding for global variable ‘isAB’
tabulate.GameDayPlays: no visible binding for global variable
‘runsOnPlay’
tabulate.GameDayPlays: no visible binding for global variable ‘isHit’
tabulate.GameDayPlays: no visible binding for global variable ‘event’
updateGame: no visible binding for global variable ‘gameId’
updateHalfInning: no visible binding for global variable ‘ab_num’
updateHalfInning: no visible binding for global variable ‘runsInInning’
updateHalfInning: no visible binding for global variable ‘runsITD’
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... WARNING
Undocumented code objects:
‘getModelRunExpectancy’ ‘getModelRunExpectancy.GameDayPlays’
‘getRAA.openWARPlays’ ‘getReplacementActivity.openWARPlays’
‘getReplacementMeans.openWARPlays’
‘getReplacementPlayers.openWARPlayers’
‘getReplacementPlayers.openWARPlays’ ‘getWAR.openWARPlays’
‘openWAR2015’ ‘shakeWAR.GameDayPlays’ ‘tabulate.GameDayPlays’
Undocumented data sets:
‘openWAR2015’
All user-level objects in a package should have documentation entries.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
* checking for code/documentation mismatches ... WARNING
Functions or methods with usage in documentation object 'getFieldResp' but not in code:
getFieldResp
Functions or methods with usage in documentation object 'getGameDay' but not in code:
getGameDay
Functions or methods with usage in documentation object 'setBIPresp' but not in code:
setBIPresp
Functions or methods with usage in documentation object 'summary.gameday' but not in code:
summary.gameday
Functions or methods with usage in documentation object 'summary.openWAR' but not in code:
summary.openWAR
* checking Rd \usage sections ... WARNING
Undocumented arguments in documentation object 'fieldingplot'
‘x’ ‘...’
Documented arguments not in \usage in documentation object 'fieldingplot':
‘model’ ‘write.pdf’
Undocumented arguments in documentation object 'flush.gameday'
‘x’
Documented arguments not in \usage in documentation object 'flush.gameday':
‘gd’ ‘gameId’
Undocumented arguments in documentation object 'gameday'
‘...’
Undocumented arguments in documentation object 'getData'
‘gameIds’
Undocumented arguments in documentation object 'getFielderResp'
‘...’
Undocumented arguments in documentation object 'getModels'
‘...’
Documented arguments not in \usage in documentation object 'getModels':
‘type’ ‘drop.incomplete’
Undocumented arguments in documentation object 'getRAA'
‘...’
Undocumented arguments in documentation object 'getReplacementMeans'
‘replIds’
Undocumented arguments in documentation object 'getReplacementPlayers'
‘nteams’ ‘...’
Undocumented arguments in documentation object 'getRunEx'
‘...’
Undocumented arguments in documentation object 'getRunnerMovement'
‘x’
Undocumented arguments in documentation object 'getURLs.gameday'
‘gd’
Documented arguments not in \usage in documentation object 'getURLs.gameday':
‘gameId’ ‘type’
Undocumented arguments in documentation object 'getWAR'
‘verbose’ ‘...’
Undocumented arguments in documentation object 'makeSubstitutions'
‘dat’
Documented arguments not in \usage in documentation object 'makeSubstitutions':
‘data’
Undocumented arguments in documentation object 'makeWAR'
‘...’
Undocumented arguments in documentation object 'plot.GameDayPlays'
‘event’
Undocumented arguments in documentation object 'plot.do.openWARPlayers'
‘...’
Undocumented arguments in documentation object 'plot.openWARPlayers'
‘...’
Undocumented arguments in documentation object 'setBIPresp'
‘...’
Undocumented arguments in documentation object 'shakeWAR'
‘...’
Undocumented arguments in documentation object 'summary.do.openWARPlayers'
‘data’ ‘n’ ‘...’
Documented arguments not in \usage in documentation object 'summary.do.openWARPlayers':
‘An’
Undocumented arguments in documentation object 'summary.gameday'
‘gd’
Undocumented arguments in documentation object 'summary.openWAR'
‘n’ ‘...’
Undocumented arguments in documentation object 'summary.openWARPlayers'
‘n’ ‘...’
Undocumented arguments in documentation object 'updateGame'
‘gameId.vec’ ‘...’
Undocumented arguments in documentation object 'updateHalfInning'
‘dat’
Documented arguments not in \usage in documentation object 'updateHalfInning':
‘data’
Functions with \usage entries need to have the appropriate \alias
entries, and all their arguments documented.
The \usage entries must correspond to syntactically valid R code.
See chapter ‘Writing R documentation files’ in the ‘Writing R
Extensions’ manual.
* checking Rd contents ... WARNING
Argument items with no description in Rd object 'getFielderId':
‘dat’
Argument items with no description in Rd object 'panel.war':
‘x’ ‘y’
Argument items with no description in Rd object 'updateHalfInning':
‘data’
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... WARNING
Note: significantly better compression could be obtained
by using R CMD build --resave-data
old_size new_size compress
May.rda 1.8Mb 1.1Mb xz
May14.rda 80Kb 59Kb xz
openWAR2012.rda 144Kb 114Kb xz
openWAR2013.rda 147Kb 116Kb xz
openWAR2014.rda 149Kb 117Kb xz
openWAR2015.rda 105Kb 83Kb xz
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... ERROR
Running examples in ‘openWAR-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: flush.gameday
> ### Title: flush.gameday
> ### Aliases: flush.gameday
>
> ### ** Examples
>
> gd = gameday()
gid_2012_08_12_atlmlb_nynmlb_1
> getURLs.gameday(gd)
Error: could not find function "getURLs.gameday"
Execution halted
Obviously, the best solution is to remove Windows. :)
My general thinking on this is that it is an issue between Sxslt
and Windows
, which are two pieces of software that we don't control. Therefore, there's really not much we can do about these compatibility issues, other than to point people in the right direction for solving them on their own.
Please see the official Sxslt
documentation for instructions about installing on Windows. Apparently there is also a GitHub version that you may have better luck installing from source.
require(devtools)
install_github("Sxslt", "cboettig")
That being said, I'll concede that if a huge proportion of the people who want to run our package can't install it, then this is a problem for us.
At some point, it might make sense to consider removing the Sxslt
dependency entirely. The advantage of using XSLT is that it enables the GameDay files to be parsed logically in one command. By doing this we are keeping our package lightweight and using the right tool for the job. The fact that this doesn't work seamlessly on Windows is (in my view) a bug in Windows.
Migrating to @cpsievert 's XML2R
package is a possible solution.
Hadley sez:
You should never use require() or library() in a package: instead, use the Depends or Imports fields in the DESCRIPTION.
(http://r-pkgs.had.co.nz/namespace.html)
WHY?!?!
This is worth thinking about:
https://twitter.com/tangotiger/status/605172517553082368
I think that RAA
will add up, across categories, for each team, but it's worth double-checking.
The way to do this would be to re-write getRAA()
so that you can group at the team level. Or better yet, have getRAA()
accept an argument that would be passed to dplyr::group_by()
. This would actually be pretty useful. Not sure how tricky this would be...
As title: package ‘Sxslt’ is not available (for R version 3.1.2)
Thanks!
What to do about games that get started, but are then called or suspended? Technically, the stats from these games don't count, but the data is live on the GameDay server.
There were three such games in the first half of 2013.
ppd = c("gid_2013_05_02_tbamlb_kcamlb_1", "gid_2013_04_16_slnmlb_pitmlb_1", "gid_2013_05_28_chnmlb_chamlb_1")
ds = subset(MLBAM2013, !gameId %in% ppd)
Should they be included by default, or not?
I think this is done, but when I do:
devtools::document()
plyr keeps getting injected into the NAMESPACE file.
xsltproc is native to both OS X and Linux, but not Windows. Thus, we need to find a way to do this from within R.
https://twitter.com/StatsbyLopez/status/604483757656145920
Also, transform() -> mutate()
For example,
subset(ds, batterName == "Pagan" & event == "Home Run")
Hadley sez:
Avoid using both upper and lower case letters: doing so makes the package name hard to type and even harder to remember. Add an extra R
http://r-pkgs.had.co.nz/package.html
> demo('build_data')
demo(build_data)
---- ~~~~~~~~~~
Type <Return> to start :
> #
> # Build the data sets used in the package
> #
> #############################################################
>
> require(openWAR)
> # Get the data from a single game
> MetsBraves = gameday()
gid_2012_08_12_atlmlb_nynmlb_1
> save(MetsBraves, file = "data/MetsBraves.rdata")
Error in gzfile(file, "wb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "wb") :
cannot open compressed file 'data/MetsBraves.rdata', probable reason 'No such file or directory'
> demo('demo')
demo(demo)
---- ~~~~
Type <Return> to start :
> #
> # Demonstration of the package
> #
> #############################################################
>
> # Get a connection to the database
> con = getCon()
Error in eval(expr, envir, enclos) : could not find function "getCon"
I haven't looked at the code yet - it might be easier to delete the demos.
Should we import all of dplyr
or mosaic
?
There are several plate appearances in 2012 that start with 3 outs!
subset(MLBAM2012, startOuts == 3)
For example, does linearWeights
need to be in the package?
data(openWAR.2012)
summary(openWAR.2012)
`
Hide Traceback
Rerun with Debug
Error: data_frames can only contain 1d atomic vectors and lists
13 stop("data_frames can only contain 1d atomic vectors and lists",
call. = FALSE)
12 as_data_frame(data)
11 tbl_df(.data)
10 filter_(tbl_df(.data), .dots = dots)
9 as.data.frame(filter_(tbl_df(.data), .dots = dots))
8 filter_.data.frame(.data, .dots = lazyeval::lazy_dots(...))
7 filter_(.data, .dots = lazyeval::lazy_dots(...))
6 filter(data, RAA.pitch != 0)
5 nrow(filter(data, RAA.pitch != 0))
4 paste("Displaying information for", nrow(data), "players, of whom",
nrow(filter(data, RAA.pitch != 0)), "have pitched\n")
3 cat(paste("Displaying information for", nrow(data), "players, of whom",
nrow(filter(data, RAA.pitch != 0)), "have pitched\n")) at openWARPlayers.R#28
2 summary.openWARPlayers(openWAR.2012)
1 summary(openWAR.2012)
`
? It's late, but I don't get what the problem is. This seems relevant:
It would be nice to have a separate data.frame that contained information about each game. This could also be built separately by just rbinding the game.xml files.
The actual error pops up after the "...Estimating Baserunning Runs Above Average..." message. The error says:
Error in makeWARBaserunning(data[br.idx, br.fields], models[["baserunning"]], :
could not find function "rename"
Is this a dplyr error?
I attached the package reshape to see if this resolved the error, and it at least changed it to something different. After attaching reshape the new error is:
Error in rename(data, cdf.br3 = cdf.lag) :
unused argument (cdf.br3 = cdf.lag)
Any ideas as to what's going on? I'm stumped.
'/usr/lib64/R/bin/R' --no-site-file --no-environ --no-save --no-restore CMD \
build '/tmp/RtmpTisOBp/devtools5e2e2c6864a9/beanumber-openWAR-cf5f77d' \
--no-resave-data --no-manual
* checking for file ‘/tmp/RtmpTisOBp/devtools5e2e2c6864a9/beanumber-openWAR-cf5f77d/DESCRIPTION’ ... OK
* preparing ‘openWAR’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
Quitting from lines 40-42 (making.Rmd)
Error: processing vignette 'making.Rmd' failed with diagnostics:
could not find function "densityplot"
Execution halted
Error: Command failed (1)
I'll go poking in the source and do a pull request if I find this before you do. ;-)
Move bigger data sets to openWARData
and update vignettes.
Create an object containing data frames that are the output of makeWAR and create methods (plot, summary, etc.) to go along with these objects
It should be like:
warplot(batterId.list | component.type, groups = batterId, data=MLBAM2013)
Do all the functions need to be in the same file?
We don't need "outs", because we already have "startOuts" and "endOuts".
These event are attributed to the runners correctly with an exception.
If a player steals a base/advances on wild pitch and then the inning end before they move on a BIP event the player gets no credit for advancing.
If there is a walk-off, all of the baserunners disappear, which makes it seems like they all got out. Consequently delta.br can be very negative, which isn't fair to the baserunners.
Hi
tried
devtools::install_github("openWAR", "beanumber")
got
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called 'RMySQL
This will aid in sanity checks for conventional statistics.
We need to know which position each player is playing in order to control for position
The parameters involved in calculating openWAR should be able to be calculated with one set of data, and then applied to another set of possibly different data. For instance, we calculate parameters using data from 2000-2012 and then calculate players openWAR for the year 2013 based on the previous years.
Hi Ben,
I recently attended your JSM talk and was excited to see that your work is open source. You might find my R package (also on GitHub), pitchRx, helpful for your work. It already has the capability of scraping more than just data recorded on the atbat level. This demo page has a decent tutorial of its capabilities.
It's interesting that you are using the RCurl package to parse the url content. If implemented properly, I think it has the potential to be faster than pitchRx::scrapeFX (which uses the XML package). It should be noted; however, that pitchRx creates additional fields for a better user experience. I discuss them briefly towards the end of this post.
I'd love to keep an open discussion to share my experiences and/or collaborate to make PITCHf/x data collection as seamless as possible.
In 'DESCRIPTION' there's this phrase:
"Those interested in the modeling choices that we have made in our computation of openWAR should consult our paper on the arXiv on that subject."
I couldn't find a link anywhere in the documentation to the paper. So I had to do a search (Yahoo, "openWAR arXiv" did the trick.)
http://arxiv.org/abs/1312.7158
Seems like that link should be somewhere in the documentation but I couldn't find it.
Why does this appear? Is it a Mac/PC file encoding error?
We probably won't be able to do UZR, but we should try to do as many as we can of the metrics that are commonly used to compute fWAR, rWAR, WARP, etc.
Write the vignettes and have them compile.
This is no longer necessary and causes problems on Windows.
Sometimes the batterPos cannot be determined by makeSubstitutions(). Usually this is due to a data error. For example, in
gid_2013_04_26_pitmlb_slnmlb_1
Jeanmar Gomez's playerId is not accurate -- instead Jonathan Sanchez's is listed. In
gid_2013_07_10_anamlb_chnmlb_1
Brooks Raley's playerId is given as 0.
Not sure how to recover from such errors.
Do it.
Do we need this function? Why would we need to update a game?
Does this give us something that getData doesn't?
library(openWAR)
The following object is masked from ‘package:base’:
tabulate
Why isn't tabulate()
a generic S3 method like plot()
and summary()
? Do I need to add setGeneric()
or something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.