title: R Error: names() applied to a non-vector
body: <p>I have a chunk of code which produces an error only the first time I run it. Strangely if I run it a second time I get no error (craziness definition?). Also the error does not show up always at the same position, I mean that if I add a few lines of comments the error message is printed after the comments and not after a specific instruction. </p>
  
  <p>I cannot provide a reproducible example because I do not know where exactly the error comes from. The error is the following:</p>
  
  <pre><code>Error in names(frame)[names(frame) == "x"] &lt;- name : 
    names() applied to a non-vector
  </code></pre>
  
  <p>I should specify that in my code I don't have -at least explicitly- a <code>names()</code> function. </p>