title: R: how to get a user-defined function to return multiple outputs?
body: <p>I want to make a function that takes one variable and returns multiple outputs, so that I can use the latter for other purposes beyond the function. Take the simplified version below for example:</p>
  
  <pre><code>user &lt;- function(x){a &lt;- x+1; a &lt;- a+0.1; b &lt;- a*-1}
  sum(a,b)
  </code></pre>
  
  <p>So if I input <code>user(10)</code>, <code>a</code> would be 11.1, <code>b</code> would be -11.1, and <code>sum(a,b)</code> would return 0. But currently R is telling me neither object 'a' or object 'b' is found. How can I fix this?</p>