Description Usage Arguments Details Value Examples
Uses year multipliers to adjust statistics to account for changes in run scoring environment. This is particularly useful because a 0.300 OBP in 2006 is much different from a 0.300 OBP in 2014.
1 | adjust_year_effects(stats, yfs, type = c("bat", "pit"))
|
stats |
data.frame of player statistics. Obtained from
|
yfs |
data.frame of multipliers for year effects. Must be in proper form. |
type |
character. Whether these are batting or pitching data. Defaults to batting |
stats
are left joined with yfs
. If any year factors
are missing, they are set to average (which is 100). The statistics are
turned into long format using gather
from the
tidyr
package. Statistics are then adjusted using the
formula:
adjusted = Count * 100 / YF
Extraneous columns are
discarded then the data are returned to a wide format using
spread
from the tidyr
package.
tbl_df
of statistics that have been adjusted for year effects.
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.