title: Why isn't for loop assigning the correct value based on the conditional statements in R
body: <p>I have a block of code where I'm trying to write a for loop to iterate through all the players in a data frame and assign a Years Pro where the value is Year - Draft Years. Glen Rice has a son who was drafted in 2013 but the years he played were around 2003-2005 so I want to assign him the proper draft year. I didn't want to interfere with his son's stats so I'm trying to write a for loop if the draft year is greater than the year it should change the draft year. Any ideas of why the for loop isn't working?</p>
  
  <p>Thanks in advance for the help</p>
  
  <pre><code>for (Player in df2){
  
  if ((df2$Player == "Glen Rice")&amp;&amp;(df2$Draft_Year &gt; df2$Year)){ 
  df2$Draft_Year &lt;- 1989}
  
  
  }
  </code></pre>