title: Debugging unexpected errors in R -- how can I find where the error occurred?
body: <p>Sometimes R throws me errors such as</p>
  
  <blockquote>
    <p>Error in if (ncol(x) != 2) { : argument is of length zero</p>
  </blockquote>
  
  <p>with no additional information, when I've written no such code. Is there a general way for finding which function in which package causes an error?</p>
  
  <p>Since most packages come compressed, it isn't trivial to grep <code>/usr/lib/R/library</code>.</p>