final_clean: Final Cleaning before Processing for Apps

Description Usage Arguments Value Examples

Description

This removes extra columns that are no longer needed and sorts the data.

Usage

1
final_clean(dat, type = c("bat", "pit"))

Arguments

dat

data.frame obtained from combine.

type

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

Value

tbl_df of statistics, bio, position, and DL information that are ready to be processed for the apps.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
curr_wd <- getwd()
setwd("N:/Apps/simScoresApp/data")
stats <- read.csv("4-mles/bat-mles.csv", header = T, stringsAsFactors = F) %>% tbl_df() %>% mutate(MLBID = as.character(MLBID))
bio <- read.csv("manual-info/bio_bat.csv", header = T, stringsAsFactors = F) %>% tbl_df() %>% mutate(MLBID = as.character(MLBID))
pos <- read.csv("manual-info/positions.csv", header = T, stringsAsFactors = F) %>% tbl_df() %>% mutate(MLBID = as.character(MLBID))
dl <- read.csv("manual-info/injuries.csv", header = T, stringsAsFactors = F) %>% tbl_df() %>% mutate(MLBID = as.character(MLBID))
x <- combine(stats, bio, pos, dl)
f <- final_clean(x, "bat")

# pitchers
pstats <- read.csv("4-mles/pit-mles.csv", header = T, stringsAsFactors = F) %>% tbl_df() %>% mutate(MLBID = as.character(MLBID))
pbio <- read.csv("manual-info/bio_pit.csv", header = T, stringsAsFactors = F) %>% tbl_df() %>% mutate(MLBID = as.character(MLBID))
px <- combine(pstats, pbio, pos, dl)
pf <- final_clean(px, "pit")
setwd(curr_wd)

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