sum_stats: Sum Statistics over Grouping Variables

Description Usage Arguments Value Examples

View source: R/app-processing.R

Description

Sums statistics for batters or pitchers. Statistics can then be used in either age_comps or level_comps.

Usage

1
sum_stats(dat, type = c("bat", "pit"), group_level = F)

Arguments

dat

data.frame of statistics. Obtained from final_clean.

type

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

group_level

boolean. Whether these statistics should be grouped by level. FALSE for use in age_comps, TRUE for use in level_comps.Defaults to FALSE.

Value

data.frame containing a player's statistics that have been summed. If group_level is TRUE, these statistics will be summed for each level a player recorded statistics. If it is FALSE, it will be summed by age.

Examples

1
2
x <- read.csv("N:/Apps/simScoresApp/data/6-for-apps/batters/bat-raw.csv", header = T, stringsAsFactors = F) %>% tbl_df()
x1 <- sum_stats(x)

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