Add a Team Stack

# S4 method for optimizer
add_team_stack(
  object,
  positions,
  opt_positions = NULL,
  nstacks = 1,
  within_lines = FALSE
)

Arguments

object

An optimizer model object

positions

Positions to stack within same team

opt_positions

A vector of optional positions. Used to build OR-based stacks, such as QB + WR + (TE or RB). Always selects just one of the optional positions.

nstacks

Number of stacks to include (Default is 1)

within_lines

Logical. Whether Stacks should be built within lines or depth. If 'sport' is not hockey, this is ignored.

Value

Updated optimizer object

Examples

if (FALSE) {
opt <- create_optimizer(site = 'DRAFTKINGS', sport = 'HOCKEY', contest_type = 'CLASSIC')
opt <- add_players_from_csv(object = opt, filepath = '/Path/to/file.csv')

# Add team stack, requiring a Center and Two Wingers from the same team
opt <- add_team_stack(object = opt, positions = c('C','W','W'))

# Add team stack, with a Center and a Winger, and one of either another center or winger
opt <- add_team_stack(object = opt, positions = c('C','W'), opt_positions = c('C','W'))
}