title: Why function does not display what it is supposed to display?
body: <p>I have the following code in R but I have problems in the output, it should display something different. This is what shows</p>
  
  <pre><code>Summary(x, y)
  
  The total square sum is: 17.5The error square sum is: 0 
  [[1]]
  NULL
  
  [[2]]
  [1] "\n"
  
  [[3]]
  NULL
  </code></pre>
  
  <p>It was supposed to display </p>
  
  <pre><code>The total square sum is: number1
  
  The error square sum is: number2
  </code></pre>
  
  <p>Could you please check it?</p>
  
  <p>(This is somehow a sample, in reality I have to display more things <code>the standar error is: number3, the variance is number4, etc..</code>)</p>
  
  <pre><code>Summary &lt;- function(x, y, print=TRUE) {
        p &lt;- 2
        n &lt;- length(x)
  
        x &lt;- matrix(c(rep(1,n),x),n,p)
        bg &lt;- solve(t(x)%*%x,t(x)%*%y)
        invx &lt;- solve(t(x)%*%x)
        xty &lt;- t(x)%*%y
        e &lt;- y-x%*%bg
        SCT &lt;- sum(y^2)-n*(mean(y)^2)
        SCE &lt;- sum(e*e)
  
        result &lt;- list(
          cat("The total square sum is:", SCT), 
          "\n", 
          cat("The error square sum is:", SCE, "\n"))
        return(result)      
  }
  
  x &lt;- y &lt;- 1:6
  Summary(x, y)
  </code></pre>