get_MLEs: Clean Stats and Get MLEs

Description Usage Arguments Value Examples

View source: R/Old wrappers/wrappers.R View source: R/wrappers.R

Description

This function is a wrapper which cleans data, then adjusts for park factors, then calculates MLEs, then adds biographical, position, and DL information.

Usage

1
2
3
4
get_MLEs(minors, majors, bio_info, position, injuries, park_factors,
  year_factors, multipliers, ignore_players, japan_ids, download_dir, clean_dir,
  pf_dir, yf_dir, mle_dir, miss_dir, app_dir, type = c("bat", "pit"),
  wd = NULL, yrs = 2005:2015)

Arguments

minors

character. Path to csv file of minor league data. Used in read.csv. Must be downloaded from PIA in proper format

majors

character. Path to csv file of major league data. Used in read.csv. Must be downloaded from PIA in proper format

bio_info

character. Path to csv file of bio data. Used in read.csv. Must be in proper format

position

character. Path to csv file of position data. Used in read.csv. Must be in proper format

injuries

character. Path to csv file of DL time. Used in read.csv. Must be in proper format

park_factors

character. Path to csv file of park factors. Used in read.csv. Must be in proper format

year_factors

character. Path to csv file of year factors. Used in read.csv. Must be in proper format

multipliers

character. Path to csv file of multipliers for MLEs. Used in read.csv. Must be in proper format

ignore_players

character. Path to csv file of players to ignore. Used in read.csv. Must be in proper format

clean_dir

character. Path to write csv file of cleaned data. Used in write.csv.

pf_dir

character. Path to write csv file of stats adjusted for park factors. Used in write.csv.

yf_dir

character. Path to write csv file of stats adjusted for year effects Used in write.csv.

mle_dir

character. Path to write csv file of MLEs. Used in write.csv.

miss_dir

character. Path to write csv file with missing data. Used in write.csv.

app_dir

character. Path to write csv file with data for apps. Used in write.csv.

type

character. Whether these are batting or pitching data. Defaults to batting

wd

character. Used in setwd to change the working directory

Value

nothing. Saves the data into the specified directories.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# batters
get_MLEs(minors = "0-downloads/bat_minors2.csv",
         majors = "0-downloads/bat_majors2.csv",
         bio_info = "manual-info/bio_bat.csv",
         position = "manual-info/positions.csv",
         injuries = "manual-info/injuries.csv",
         park_factors = "manual-info/Park_Factors.csv",
         year_factors = "manual-info/Year-Factors.csv",
         multipliers = "manual-info/Level_Multipliers.csv",
         ignore_players = "manual-info/players_to_ignore.csv",
         japan_ids = "manual-info/japan_ids.csv",
         download_dir = "0-downloads/",
         clean_dir = "1-cleaned/batters/",
         pf_dir = "2-park-adjusted/",
         yf_dir = "3-year-adjusted/",
         mle_dir = "4-mles/",
         miss_dir = "5-missing/",
         app_dir = "6-for-apps/batters/",
         wd = "N:/Apps/simScoresApp/data/",
         type = "bat",
         yrs = 2005:2014)
# pitchers
get_MLEs(minors = "0-downloads/pit_minors2.csv",
         majors = "0-downloads/pit_majors2.csv",
         bio_info = "manual-info/bio_pit.csv",
         position = "manual-info/positions.csv",
         injuries = "manual-info/injuries.csv",
         park_factors = "manual-info/Park_Factors.csv",
         year_factors = "manual-info/Year-Factors.csv",
         multipliers = "manual-info/Level_Multipliers.csv",
         ignore_players = "manual-info/players_to_ignore.csv",
         japan_ids = "manual-info/japan_ids.csv",
         download_dir = "0-downloads/",
         clean_dir = "1-cleaned/pitchers/",
         pf_dir = "2-park-adjusted/",
         yf_dir = "3-year-adjusted/",
         mle_dir = "4-mles/",
         miss_dir = "5-missing/",
         app_dir = "6-for-apps/pitchers/",
         wd = "N:/Apps/simScoresApp/data/",
         type = "pit",
         yrs = 2005:2014)

guytuori/simScores documentation built on May 17, 2019, 9:29 a.m.