title: Calculating sum of squared deviations in R
body: <p>How can I calculate the sum of squared deviations(from the mean) of a vector?</p>
  
  <p>I tried using the command</p>
  
  <blockquote>
    <p>sum(x-mean(x))^2</p>
  </blockquote>
  
  <p>but unfortunately what this returns is -1.998401e-15 which cannot be right. Is there a subtle operator, like a parenthesis, that I am missing here perhaps?</p>
  
  <p>Thanks.</p>