title: How to create xml from R objects, e.g., is there a 'listToXml' function?
body: <p>R's <a href="http://cran.r-project.org/package=XML" rel="noreferrer">XML</a> package has an xmlToList function, but does not have the reverse, is there a function for R that will convert a list to an XML object?</p>
  
  <p>I would like something like</p>
  
  <pre><code>listToXML(list('a'))
  </code></pre>
  
  <p>that returns</p>
  
  <pre><code>&lt;a&gt;&lt;/a&gt;
  </code></pre>
  
  <p>but the closest I can find is</p>
  
  <pre><code>library(XML)
  xmlNode(list('a'))
  </code></pre>
  
  <p>which returns</p>
  
  <pre><code>&lt;/a&gt;
  </code></pre>
  
  <p>help on this question, and understanding the conversion of R objects to XML in general appreciated (the XML package appears more focused on the use of R to read XML, with less support for creating XML). </p>
  
  <p><strong>Update...</strong> One reason that I could not figure this out is because I did not realize that the trailing '/' in <code>&lt;node/&gt;</code> indicates an empty node, equivalent to <code>&lt;node&gt;&lt;/node&gt;</code></p>