title: Save html result to a txt or html file
body: <p>I have a variable with html code.</p>
  
  <p>Here what the code variable outpout in R console:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;h1&gt;My First Heading&lt;/h1&gt;
  
  &lt;p&gt;My first paragraph.&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I try to save the content into a txt file</p>
  
  <pre><code> write.table(code, file='C:/Users/Desktop/code_result.txt')
  </code></pre>
  
  <p>But it stacks with this error:</p>
  
  <pre><code>Error in as.data.frame.default(x[[i]], optional = TRUE) : 
    c("cannot coerce class \"c(\"HTMLInternalDocument\", \"HTMLInternalDocument\", \"XMLInternalDocument\", \" to a data.frame", "cannot coerce class \"\"XMLAbstractDocument\")\" to a data.frame")
  </code></pre>