title: R LpSolve How to optimize picks with Budget Restriction
body: <p>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).</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>I´m very grateful for your help !</p>
  
  <p>My panel looks like this (example):</p>
  
  <p>footballplayerID | gamesplayed | avggoals | costsperplayer</p>
  
  <ol>
  <li>233276       |      120     |    80     |    50.000</li>
  <li>474823       |      200     |    140    |    34.000</li>
  <li>192834       |      150     |    90     |    14.000</li>
  <li>192833       |      30      |    50     |    90.000</li>
  <li>129834       |      204     |    129    |    70.000</li>
  <li>347594       |      123     |    19     |    10.000</li>
  <li>203845       |      129     |    57     |    43.000</li>
  <li>128747       |      98      |    124    |    140.000</li>
  </ol>
  
  <p>.</p>
  
  <p>.</p>
  
  <ol start="500">
  <li>123749      |      128     |    182    |   100.000</li>
  </ol>