normalize_positions: Normalize positions by allowed counts

Description Usage Arguments Examples

View source: R/write.r

Description

Will replace positions with wildcard if their count exceeds the max allowed. This is commonly used to set a player to a utility or flex position.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

Arguments

pos

a character vector of existing positions

pos_max

a named numeric vector giving the max allowed players at that position

wildcard

a string specifying what to replace positions with

Examples

1
2
3
4
5
6
7
8
## Not run: 
 pos <- c("P", "1B", "1B", "2B", "3B", "SS", "OF", "OF", "OF")
 pos_max <- c("P" = 1, "1B" = 1, "2B" = 1, "3B" = 1, "SS" = 1, "OF" = 3)
 wildcard <- "UTIL"

 normalize_positions(pos, pos_max, wildcard)

## End(Not run)

zamorarr/coach documentation built on Dec. 24, 2021, 3:06 p.m.