title: Sum of returned list: Error: invalid 'type' (list) of argument
body: <p>For my script I'm returning a bunch of variables in R, and after splitting up my script in more functions I need to return some lists, along with other data.</p>
  
  <p>I know I can return multiple values by <code>c(value1, value2)</code>. But how can I do this when one of the items returned is actually a list?
  I'm returning listOne, however it looks like the data type gets changed when returning. 
  How can I get return the list without changing its type?</p>
  
  <p>Here's an example:</p>
  
  <pre><code>  B &lt;- function(){
     listOne &lt;- c(1,2,3,4,5,6)
     testString &lt;- "Test"
     return(list(listOne, testString))
   }
    returnlist &lt;- B()
  </code></pre>
  
  <p>Assigning the variables according to the returned list:</p>
  
  <pre><code>  copy.listOne &lt;- returnlist# [1]
    copy.testString &lt;- returnlist[2]
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>  listOne &lt;- c(1,2,3,4,5,6)
    print(sum(listOne))
  # [1] 21
  </code></pre>
  
  <p>Actual output: </p>
  
  <pre><code>  print(sum(copy.listOne))
  Error in print(sum(copy.listOne)) : 
    error in evaluating the argument 'x' in selecting a method for function 'print': Error in sum(copy.listOne) : invalid 'type' (list) of argument
  </code></pre>