title: How do I get the file path of an output in R
body: <p>@r2evans<br>
  [1] Tembec Inc. Tembec Inc. Tembec Inc.
  197 Levels: National Bank of Canada Fonds de placement du Barreau du QuÃ©bec ... Irving Resources Inc.</p>
  
  <pre><code>&gt; dest
  [1] "C:\\Sedar_data\\2016\\2016_02\\balance-sheets"
  &gt; myfiles
   [1] "C:\\Sedar_data\\2016\\2016_02\\balance-sheets/02427367-00000007-00038001-i@#SLH#Sedar2#Western#FINALPROSPECTUS-PDF-REGFILE.xml"                           
   [2] "C:\\Sedar_data\\2016\\2016_02\\balance-sheets/02439236-00000002-00026641-C@#SEDAR#2016#First_Quarter_Report-PDF-REGFILE.xml"                              
  C@#SEDAR#FILINGS#151231Ironside_Q2FS_cm-PDF-REGFILE.xml"                         
   [9] "C:\\Sedar_data\\2016\\2016_02\\balance-sheets/02440535-00000001-00002159-s@#SEDAR#Firan#Annual#AnnualReport-2015-FTG-PDF-REGFILE.xml"                     
  [10] "C:\\Sedar_data\\2016\\2016_02\\balance-sheets/02440536-00000001-00002159-s@#SEDAR#Firan#Annual#MD-A-2015-FTG-PDF-REGFILE.xml"                             
  </code></pre>
  
  <p>Suppose that these are the input files. If I want to output Firan    then the output would be 
  [11] "C:\Sedar_data\2016\2016_02\balance-sheets/02440538-00000001-00002159-s@#SEDAR#Firan#Annual#AFS-2015-FTG-PDF-REGFILE.xml"  </p>
  
  <p>I am reading multiple XML files from my computer via</p>
  
  <pre><code>dest &lt;- "C:\\my_data\\2016\\2016_02"
  </code></pre>
  
  <p>Out of that XML files I output the tags. I am filtering the files according to name of the companies. </p>
  
  <pre><code>look.for &lt;- c( "Technology Group Corporation") 
  name_filter &lt;- filesList_df[filesList_df$`names_try[1, 1]`  %in% look.for ,]               name_filter
  </code></pre>
  
  <p>It outputs as</p>
  
  <pre><code> &gt; name_filter
  [1]Technology Group Corporation Firan Technology Group Corporation Firan Technology Group Corporation
  [4] Technology Group Corporation Firan Technology Group Corporation Firan Technology Group Corporation
  [7] Technology Group Corporation Firan Technology Group Corporation
  197 Levels:Bank  ...  Resources Inc.
  </code></pre>
  
  <p>However, I actually would like to output the path of these files. Could you  please help me how I can do it, thanks in advance.</p>
  
  <p>The full code is </p>
  
  <pre><code>library(XML)
  library(methods)
  library(plyr)
  library(stringr)
  ###############
  #Parsing the files will be beneficial ##########
  #d1 &lt;- "C:\\Users\\DSLGuest\\Desktop\\Data\\2016/2016_03/2016-03-16/02455279-00000001-00001297-C@#Temp#BORALEX#2016#aNNUALfILINGS#MDA#MDAeng-PDF-REGFILE.xml"
  #doc1 &lt;- xmlParse(d1)
  #doc1
  ##########################################################################
  dest &lt;- "C:\\Sedar_data\\2016\\2016_02"
  myfiles &lt;- list.files(path = dest, recursive=TRUE, pattern = "xml", full.names = TRUE)
  filesList_df &lt;- data.frame(File=character(), stringsAsFactors=FALSE)
  for (i in myfiles){
  result &lt;- xmlParse(i)
  #print(result)
  rootnode &lt;- xmlRoot(result)
  #print(rootnode)
  rootsize &lt;- xmlSize(rootnode)
  
  #print(rootnode[[15]][[1]][[2]]) }   #GIVES the NAME_of_the_company
  
  names_try &lt;- (ldply(xmlToList(rootnode[[15]][[1]][[2]]), data.frame ))
  
  filesList_df &lt;- rbind(filesList_df, as.data.frame(names_try[1,1]))
  filesList_df
  look.for &lt;- c( "Firan Technology Group Corporation")
  name_filter &lt;- filesList_df[filesList_df$`names_try[1, 1]`  %in% look.for ,] 
  name_filter
  
  }
  </code></pre>