title: data table and data frame operations
body: <p>I am using some R code that uses a data table class, instead of a data frame class.</p>
  
  <p>How would I do the following operation in R without having to transform map.dt to a map.df?</p>
  
  <pre><code>map.dt = data.table(chr = c("chr1","chr1","chr1","chr2"), ref = c(1,0,3200,3641), pat = c(1,3020,3022, 3642), mat = c(1,0,3021,0))
  parent = "mat"
  chrom = "chr1"
  map.df&lt;-as.data.frame(map.dt);
  parent.block.starts&lt;-map.df[map.df$chr == chrom &amp; map.df[,parent] &gt; 0,parent];
  </code></pre>
  
  <p>Note:  parent needs to be dynamically allocated, its an input from the user.  In this example I chose "mat" but it could be any of the columns. </p>
  
  <p>Note1: parent.block.starts should be a vector of integers.</p>
  
  <p>Note2: map.dt is a data table where the column names are c("chr","ref","pat","mat").  </p>
  
  <p>The problem is that in data tables I cannot access a given column by name, or at least I couldn't figure out how.</p>
  
  <p>Please let me know if you have some suggestions!</p>
  
  <p>Thanks!</p>