title: Getting the following error in R: Error: 1: Start tag expected, '<' not found
body: <p>I searched the site thoroughly but didn't find an answer. The script looks into a file directory and appends into a vector of filenames (which I then turn into a dataframe). For is then used to iterate through custom function which consumes as argument the file name. The parser works fine with one file name (i.e. when I force it in <code>parser(filename)</code> otherwise fails when runs through the for loop). So I suspect it's how I'm passing the argument.</p>
  <pre><code>files &lt;- list.files(path=&quot;~/pathname&quot;, pattern=&quot;*.xml&quot;, full.names = F, recursive=FALSE)
  files.df &lt;- as.data.frame(files)
  for (i in 1:nrow(files.df)) {
  parser(as.character(files.df[i,]))
  }
  </code></pre>
  <p>When I <code>print(as.character(files.df[i,])</code>, the output is as expected. Again, running the custom parser with one file name (outside the for loop) as argument works perfectly. The <code>setwd</code> is the same as that of where the files are read from.</p>
  <p>Anything you may have come across before?</p>
  <p><em>Update:</em> the script worked fine yesterday with one file but now I get the same error. It seems to happen at this line:</p>
  <pre><code>xmlfile=xmlParse(filename, useInternalNodes = TRUE)
  </code></pre>