title: R function to use passed object name+ another name inside
body: <p>I want to build a function that calls another object that name is related to the main object name. </p>
  
  <p>For example, Main object is 'VCU_Players' and the other object is 'VCU_Players_opp'</p>
  
  <p>in my function i need to use both objects in my calculations.</p>
  
  <p>So i am trying to do </p>
  
  <pre><code>my_function&lt;- function(x) {
    y&lt;-deparse(substitute(x))
    z&lt;-"_opp"
    y&lt;- paste(y,z,sep = "")
  
  #My Calculations
  x$newfield&lt;- x$pts+ y$pts
  Return(x)
  }
  </code></pre>
  
  <p>Now i want to pass the object VCU_Players to the function </p>
  
  <p>my_function(VCU_Players)</p>
  
  <p>But the function doesn't figure the VCU_Players_opp  object </p>