The team has a budget of $10,500,000 and must select two players.
players <- data.frame(
Player = c("Yandy Diaz", "Joey Meneses", "Jose Abreu", "Ryan Noda", "Nate Lowe"),
OBP = c(0.403, 0.320, 0.292, 0.384, 0.365),
SLG = c(0.511, 0.366, 0.358, 0.400, 0.426),
Salary = c(8000000, 723600, 19500000, 720000, 4050000)
)
players
## Player OBP SLG Salary
## 1 Yandy Diaz 0.403 0.511 8000000
## 2 Joey Meneses 0.320 0.366 723600
## 3 Jose Abreu 0.292 0.358 19500000
## 4 Ryan Noda 0.384 0.400 720000
## 5 Nate Lowe 0.365 0.426 4050000
budget <- 10500000
selected_players <- players[players$Player %in% c("Yandy Diaz", "Ryan Noda"), ]
selected_players
## Player OBP SLG Salary
## 1 Yandy Diaz 0.403 0.511 8000000
## 4 Ryan Noda 0.384 0.400 720000
total_salary <- sum(selected_players$Salary)
remaining_budget <- budget - total_salary
cat("Total Salary: $", format(total_salary, big.mark = ","), "\n")
## Total Salary: $ 8,720,000
cat("Remaining Budget: $", format(remaining_budget, big.mark = ","))
## Remaining Budget: $ 1,780,000
I would select Yandy Diaz and Ryan Noda.
Yandy Diaz has the highest on-base percentage (.403) and slugging percentage (.511), making him the strongest offensive player available. Ryan Noda has the second-highest on-base percentage (.384) and provides excellent value because of his low salary.
Their combined salary is $8,720,000, which is within the $10,500,000 budget and leaves $1,780,000 remaining. This combination provides the best balance of offensive production and cost while staying under budget.