title: Within function how to correctly pass a parameter as a data attribute in R?
body: <p>I want to write a function which returns a particular attribute of a data subject as follows</p>
  
  <pre><code>dem &lt;- function(sale, attToCall = "year" ){
  return(sale$attToCall)
  }
  
  aa &lt;- data.frame("month" = sample(1:12, 10),"year" = sample(1990:2016, 10))
  
  dem(aa, attToCall = "year") 
  </code></pre>
  
  <p>doesn't work, anyone has solution?</p>