Description Usage Arguments Examples
View source: R/similarity-scores.R
Similarity Scores Averaged Across Level
1 | level_comps(player, data, weights, years = 3, type = c("bat", "pit"))
|
player |
character. The name of the focus player, formatted as "Last; First M." |
data |
The dataset of MLEs. Should be the |
weights |
Numeric, named vector. The names tell which variables to use for comparisons. The value tells the weight put on that variable when comparing. |
years |
numeric vector of length 1 or 2. If length 1, specifies how many years of statistcs to include. If length two, specifies the age range over which to compare (inclusive). |
type |
character. Whether these are batting or pitching data. Defaults to batting. |
1 2 3 4 5 6 7 | load("H:/simScoresApp/b-comparison-app/bat_simscore_data.RData")
wts <- c(position = .05, pa = .9, bb.perc = .66, k.perc = .84, iso = .84, babip = .23, obp = .92)
# comparing stats based on three most recent years
level_comps("Brown; Domonic L.", level_grp, wts, 3, "bat")
# comparing stats from age 24 to 26
level_comps("Brown; Domonic L.", level_grp, wts, c(24, 26), "bat")
# same thing!
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.