title: Assigning operators into an R variable
body: <p>I am trying to create a function where users can select the operator they want to use, which result in a different output. But I can't seem to get it to work. I know that we can't assign operators into an R object and then use it as an operator based on the R object name. Is there a way I could do this? Or perhaps a better way to write the function? </p>
  
  <pre><code>test &lt;- function(items, operator = "+"){
  bank_alpha &lt;- matrix(ncol=6)
  colnames(bank_alpha) &lt;- colnames(bank_alpha, do.NULL = FALSE, prefix = "Q")
  colnames(bank_alpha)[6] &lt;- "A"
  alphabet &lt;- LETTERS[seq(1:26)]
  
   for (i in 1:items) {
    item &lt;- c(alphabet[i], alphabet[i operator 1], alphabet[i operator  2], alphabet[i operator  3], alphabet[i operator  4], alphabet[i operator 5])
    bank_alpha &lt;- rbind(bank_alpha, item)
    bank_alpha &lt;- na.omit(bank_alpha)
  }
  return(bank_alpha)
  }
  
    test(items=4, operator = "-") 
  </code></pre>