title: How to interpret this error message: (list) object cannot be coerced to type 'double'
body: <p>I have a table: numTable that looks like this:
  <a href="https://i.stack.imgur.com/lJfIQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lJfIQ.png" alt="enter image description here"></a></p>
  
  <p>Now I want to find outiers for each of these columns. Please see my code below:</p>
  
  <pre><code>for (i in names(numTable)) {
    #calculate mean and std for each column
    meanValue &lt;- mean(numTable[,i], na.rm=TRUE)
    stdValue&lt;-sd(numTable[,i],na.rm=TRUE)
    #Sum up number of outliers for each column
    print(paste("there are",sum(abs(numTable[,i]-meanValue)&gt;3*stdValue,na.rm =  
  TRUE),"outliers in the column",i))
   } 
  </code></pre>
  
  <p>But I get error message: </p>
  
  <pre><code>Error in is.data.frame(x) : (list) object cannot be coerced to type 'double'
  </code></pre>
  
  <p>I fixed this problem by adding <code>numTable&lt;-as.data.frame(numTable)</code> at the beginning. 
  Could you please tell me why I have to add this line for my code to work? Does it have something to do with difference between tbl and data.frame?
  Thanks.</p>