title: r - xpathApply on XMLNodeSet (with XML package)
body: <p>I am trying to use xpathApply function in XML package in R to extract certain data from a html file.
  However, after I use xpathApply on some parent nodes of the html document, the class of the resulting object becomes XMLNodeSet, and I cannot further use xpathApply on such object, as this error message appears: “Error in UseMethod("xpathApply") : no applicable method for 'xpathApply' applied to an object of class "XMLNodeSet"”</p>
  
  <p>Here is the R script I am trying to replicate my problem (this example is just a simple table, I know I can use readHTMLtable function, but I need to use more low level function to work because my actual html is more complicated than this simple table):</p>
  
  <pre><code>library(XML)
  y &lt;- htmlParse(htmlfile)
  x &lt;- xpathApply(y, "//table/tr")
  z &lt;- xpathApply(x, "/td")
  </code></pre>
  
  <p>Here is the “htmlfile”:</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
  &lt;td&gt; Test1.1 &lt;/td&gt; &lt;td&gt; Test1.2 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt; Test1.3 &lt;/td&gt; &lt;td&gt; Test1.4 &lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Is there any method to further work on the nodes after using xpathApply? Or are there other good alternatives to play around the data in the nodes?</p>