title: Getting a specific value of data.table using a variable in R
body: <p>I am wanting to us a specific value of a data.table.  The column names and amount of columns are always changing, so I cannot use :</p>
  
  <pre><code>df$column_5[2]
  </code></pre>
  
  <p>Or :</p>
  
  <pre><code>df[2,5]
  </code></pre>
  
  <p>To get value I need.</p>
  
  <p>I would like to do something similar to the following:</p>
  
  <pre><code>x &lt;- 5
  df[2,x]
  </code></pre>
  
  <p>But I get an error saying: </p>
  
  <blockquote>
    <p>df[2,x]
        Error in <code>[.data.table</code>(df, 2, x) : 
        j (the 2nd argument inside [...]) is a single symbol but column name 'x' is not found. Perhaps you intended DT[, ..x]. This difference to data.frame is deliberate and explained in FAQ 1.1."</p>
  </blockquote>
  
  <p>Do you have any solutions to this issue?</p>