title: data.table assigning output to a variable column
body: <p>So I have a loop that I want to implement which assigns the original value (in row a and col b) + 1 if the value (at row a and col b) is equal to a certain number, however, when i try to assign the number using <code>with = FALSE</code>, I am unable to do so, and removing it yields me an output where the whole col is <code>=</code> to original value (in row a and col b) + 1.</p>
  
  <p>Test Case:</p>
  
  <pre><code>a &lt;- rep(0,6)
  b &lt;- 1:6
  c &lt;- -3:2
  d &lt;- runif(6)
  e &lt;-runif(6)
  dt1 &lt;- data.table("ID" = b,"code_a" = a,"code_c" = c, "code_d" = d, "code_e" = e)
  dt1
     ID code_a code_c    code_d      code_e
  1:  1      0     -3 0.5369538 0.269854945
  2:  2      0     -2 0.7186787 0.009384648
  3:  3      0     -1 0.8053726 0.831286263
  4:  4      0      0 0.2084106 0.171294349
  5:  5      0      1 0.0130021 0.730679582
  6:  6      0      2 0.2902858 0.062175009
  </code></pre>
  
  <p>So in the following I have assigned <code>ctr &lt;- 1</code> and tested the scenario that I wanted to replace <code>col_2</code> and <code>row_1</code> with the number 1, but unfortunately, neither scenario is my desired output.</p>
  
  <p>My Attempt number 1:</p>
  
  <pre><code>dt1[,eval(ctr+1), with = FALSE][ctr] &lt;- 1
  
  Error in `[&lt;-.data.table`(`*tmp*`, , eval(ctr + 1), with = FALSE, value = list( : 
    unused argument (with = FALSE)
  </code></pre>
  
  <p>My Attempt number 2:</p>
  
  <pre><code>dt1[,eval(ctr+1)][ctr] &lt;- 1
  &gt; dt1
     ID code_a code_c    code_d      code_e
  1:  1      1     -3 0.5369538 0.269854945
  2:  2      1     -2 0.7186787 0.009384648
  3:  3      1     -1 0.8053726 0.831286263
  4:  4      1      0 0.2084106 0.171294349
  5:  5      1      1 0.0130021 0.730679582
  6:  6      1      2 0.2902858 0.062175009
  </code></pre>
  
  <p>Desired Output:</p>
  
  <pre><code>   ID code_a code_c    code_d      code_e
  1:  1      1     -3 0.5369538 0.269854945
  2:  2      0     -2 0.7186787 0.009384648
  3:  3      0     -1 0.8053726 0.831286263
  4:  4      0      0 0.2084106 0.171294349
  5:  5      0      1 0.0130021 0.730679582
  6:  6      0      2 0.2902858 0.062175009
  </code></pre>
  
  <p>This is probably asked before, but I am unable to find the correct way to find the thread that asked this question. I also tried using <code>..ctr</code> but to no success. If anyone can help me understand whats going on, it would be greatly appreciated.</p>