I have a question about LpSolve in R. I have a panel with the following data: Football player ID (around 500 player), how many games each of them has already played, number of goals scored and cost of the player. I want to create a matrix from this data, but I do not know how this works with such a large amount of data (I have about 500 football players an therefore 500 rows).
The goal is to select the optimal number of players for a budget of 1,000,000. Each player can only be selected once, optimized by the number of scored goals.
In the end I want to have the optimal selection of players which scored the most goals, and the budget has to be (almost) used up.
Since I am relatively new with R I do not know how to solve this problem with LpSolve yet and I fail at the matrix production and the constraints.
I´m very grateful for your help !
My panel looks like this (example):
footballplayerID | gamesplayed | avggoals | costsperplayer
- 233276 | 120 | 80 | 50.000
- 474823 | 200 | 140 | 34.000
- 192834 | 150 | 90 | 14.000
- 192833 | 30 | 50 | 90.000
- 129834 | 204 | 129 | 70.000
- 347594 | 123 | 19 | 10.000
- 203845 | 129 | 57 | 43.000
- 128747 | 98 | 124 | 140.000
.
.
- 123749 | 128 | 182 | 100.000